Purpose: Add recurring errors to knowledge base with deduplication
Last Updated: 2026-01-06
Action: Search for similar/related errors
Process:
Format:
Searching for: "Cannot read property 'map' of undefined"
Found 1 similar error:
๐ development/errors/react-errors.md (Line 45)
## Error: Cannot read property 'X' of undefined
Covers: General undefined property access
Frequency: common
Found 2 related errors:
๐ development/errors/react-errors.md
## Error: Cannot read property 'length' of undefined
## Error: Undefined is not an object
Action: Present deduplication options
Format:
Options:
[A] Add as new error to react-errors.md
(Specific case: 'map' on undefined array)
[B] Update existing 'Cannot read property X' error
(Add 'map' as common example)
[C] Skip (already covered sufficiently)
Which framework/category?
[1] React (react-errors.md)
[2] JavaScript (js-errors.md)
[3] General (common-errors.md)
[4] Create new: ___
Select option + category (e.g., 'B 1'):
Validation: MUST wait for user input
Action: Show full error entry before adding
Format:
Would update development/errors/react-errors.md:
Current (Line 45):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
## Error: Cannot read property 'X' of undefined
**Symptom**:
TypeError: Cannot read property 'X' of undefined
**Cause**: Attempting to access property on undefined/null object.
**Solution**:
1. Add null check
2. Use optional chaining (?.)
3. Provide default value
**Code**:
```jsx
// โ Before
const value = obj.property
// โ
After
const value = obj?.property ?? 'default'
Prevention: Always validate data exists Frequency: common Reference: [Link] โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Proposed update: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Symptom:
TypeError: Cannot read property 'X' of undefined
TypeError: Cannot read property 'map' of undefined โ NEW
TypeError: Cannot read property 'length' of undefined โ NEW
Cause: Attempting to access property on undefined/null object. Common with array methods (map, filter) when data hasn't loaded. โ NEW
Solution:
Code:
// โ Before
const value = obj.property
const items = data.map(item => item.name) โ NEW
// โ
After
const value = obj?.property ?? 'default'
const items = (data || []).map(item => item.name) โ NEW
Prevention: Always validate data exists. For arrays, provide empty array default. โ UPDATED Frequency: common Reference: [Link] โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
File size: 98 lines โ 105 lines (under 150 limit โ)
Approve? (yes/no/edit):
**Edit mode**: Allow modification before adding
**Validation**: MUST get approval before proceeding
---
### Stage 4: Add/Update
**Action**: Add or update error entry
**Process**:
1. Add/update error in target file
2. Follow error template format
3. Maintain file size <150 lines
4. Update "Last Updated" date
**Template Format**:
```markdown
## Error: {Name}
**Symptom**: [Error message]
**Cause**: [Why - 1-2 sentences]
**Solution**: [Steps]
**Code**: [Before/After example]
**Prevention**: [How to avoid]
**Frequency**: common/occasional/rare
**Reference**: [Link]
Action: Update README.md and add cross-references
Process:
Action: Show results
Format:
โ
Added error to {category}/errors/{file}.md
๐ Cross-referenced with X related errors
๐ Updated README.md (if needed)
Changes:
- Updated existing error entry
- Added 'map' and 'length' examples
- File size: 105 lines (under 150 limit)
Same root cause, different manifestations โ Update existing to include new examples
Different causes, same category โ Cross-reference between errors
Exact same error already documented โ Skip (already covered)
Unique error not yet documented โ Add as new error entry
Group errors by framework/topic in single file:
react-errors.md - All React errorsnextjs-errors.md - All Next.js errorsauth-errors.md - All authentication errorsDon't create: One file per error (too granular)
/context error for "hooks can only be called inside components"
/context error for "Cannot read property 'map' of undefined"
/context error for "Hydration failed in Next.js"