thedotmack/claude-mem · warning
Error processing folder
Error message
Error processing folder: ${relativeFolder} What it means
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.
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
Example fix
null
Defensive patterns
Strategy: fallback
Validate before calling
for (const folder of trackedFolders) {
if (!existsSync(folder)) { errorCount++; continue; } // pre-skip known-bad folders
// ... regenerateFolder(folder)
} Try / catch
const result = regenerateFolder(folder);
if (!result.success && !result.error?.includes('No observations')) {
logger.warn('CLAUDE_MD', `Error processing folder: ${folder}`, { error: result.error });
} Prevention
- 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
When it happens
Trigger: 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').
Common situations: 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.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- Error processing
- Failed to regenerate folder
- CLAUDE_CODE_PATH is set to
- Corrupt JSON file, refusing to overwrite
- Could not read
AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17).
Data as JSON: /api/errors/720f6358f7256dc5.
Report an issue: GitHub.
Appendix: source
Thrown at src/cli/claude-md-commands.ts:355
const result = regenerateFolder(
db,
absoluteFolder,
relativeFolder,
project,
dryRun,
workingDir,
observationLimit
);
if (result.success) {
logger.debug('CLAUDE_MD', `Processed folder: ${relativeFolder}`, {
observationCount: result.observationCount
});
successCount++;
} else if (result.error?.includes('No observations')) {
skipCount++;
} else {
logger.warn('CLAUDE_MD', `Error processing folder: ${relativeFolder}`, {
error: result.error
});
errorCount++;
}
}
db.close();
logger.info('CLAUDE_MD', 'CLAUDE.md generation complete', {
totalFolders: foldersArray.length,
withObservations: successCount,
noObservations: skipCount,
errors: errorCount,
dryRun
});
return 0;
}View on GitHub (pinned to d8bc9755e7)