{"record":{"id":"720f6358f7256dc5","repo":"thedotmack/claude-mem","slug":"error-processing-folder-relativefolder","errorCode":null,"errorMessage":"Error processing folder: ${relativeFolder}","messagePattern":"Error processing folder: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cli/claude-md-commands.ts","lineNumber":355,"sourceCode":"    const result = regenerateFolder(\n      db,\n      absoluteFolder,\n      relativeFolder,\n      project,\n      dryRun,\n      workingDir,\n      observationLimit\n    );\n\n    if (result.success) {\n      logger.debug('CLAUDE_MD', `Processed folder: ${relativeFolder}`, {\n        observationCount: result.observationCount\n      });\n      successCount++;\n    } else if (result.error?.includes('No observations')) {\n      skipCount++;\n    } else {\n      logger.warn('CLAUDE_MD', `Error processing folder: ${relativeFolder}`, {\n        error: result.error\n      });\n      errorCount++;\n    }\n  }\n\n  db.close();\n\n  logger.info('CLAUDE_MD', 'CLAUDE.md generation complete', {\n    totalFolders: foldersArray.length,\n    withObservations: successCount,\n    noObservations: skipCount,\n    errors: errorCount,\n    dryRun\n  });\n\n  return 0;\n}","sourceCodeStart":337,"sourceCodeEnd":373,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/cli/claude-md-commands.ts#L337-L373","documentation":"processAllFoldersForGeneration iterates tracked folders and calls regenerateFolder for each. When a folder's regeneration fails for a reason other than 'No observations', this warning logs the folder name and error and increments errorCount; generation continues with remaining folders. This is an aggregator surface — the real cause is in result.error from error 303.","triggerScenarios":"generateClaudeMd runs over all tracked folders and one or more folders fail regeneration due to write permission errors, missing directories, or formatting exceptions (anything whose error string does not contain 'No observations').","commonSituations":"Batch CLAUDE.md regeneration after pulling a repo where some folders are read-only; folders removed externally mid-run; malformed observation data in specific folders.","solutions":["Read the error field in the log to identify the failing folder's root cause (usually an fs error)","Fix write permissions or recreate the missing folder, then re-run generateClaudeMd","Clear stale tracked-folder entries for folders that no longer exist","Re-run the command — it is per-folder idempotent and safe to retry"],"exampleFix":"null","handlingStrategy":"fallback","validationCode":"for (const folder of trackedFolders) {\n  if (!existsSync(folder)) { errorCount++; continue; } // pre-skip known-bad folders\n  // ... regenerateFolder(folder)\n}","typeGuard":null,"tryCatchPattern":"const result = regenerateFolder(folder);\nif (!result.success && !result.error?.includes('No observations')) {\n  logger.warn('CLAUDE_MD', `Error processing folder: ${folder}`, { error: result.error });\n}","preventionTips":["Prune tracked folders that no longer exist before batch runs","Run on a writable checkout (not read-only CI mounts)","Review each per-folder error instead of re-running blindly","Keep CLAUDE.md generation idempotent so retries are safe"],"tags":["filesystem","batch-processing","claude-md"],"backgroundTag":"file-write-failed","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}