rohitg00/agentmemory · warning
${baseMsg} Re-run with --max-files=${suggested} (max ${upper
Error message
${baseMsg} Re-run with --max-files=${suggested} (max ${upper}) or batch by subdirectory. What it means
Post-import warning when the scan cap was hit but the tree is still within the server's hard limit — raising --max-files can help. The CLI suggests a concrete value (capped at the server upper bound) or batching.
Source
Thrown at src/cli.ts:3812
const skipped = discovered - (json.imported ?? 0);
const discoveredLabel = json.traversalCapped
? `${discovered}+ (traversal halted at safety cap)`
: String(discovered);
const baseMsg = `Hit the ${cap}-file scan cap; ${skipped} of ${discoveredLabel} discovered file(s) were skipped.`;
// If we already saw more than the server's hard cap (or the
// walker stopped early), bumping --max-files won't help on its
// own — recommend batching by subdirectory.
if (discovered > upper || json.traversalCapped) {
p.log.warn(
`${baseMsg} Tree exceeds the server's --max-files limit of ${upper}; ` +
`batch by subdirectory (run import-jsonl once per project under ~/.claude/projects).`,
);
} else {
const suggested = Math.min(
Math.max((discovered || cap) + 100, cap * 2),
upper,
);
p.log.warn(
`${baseMsg} Re-run with --max-files=${suggested} (max ${upper}) or batch by subdirectory.`,
);
}
}
if (json.sessionIds && json.sessionIds.length > 0) {
p.log.info(`View at ${getViewerUrl()} → Replay tab`);
}
} catch (err) {
spinner.stop("failed");
if (err instanceof Error && err.name === "TimeoutError") {
p.log.error("import timed out after 2 minutes");
} else {
p.log.error(err instanceof Error ? err.message : String(err));
}
process.exit(1);
}
}
View on GitHub (pinned to e04ba88819)
Solutions
- Re-run with the suggested value: --max-files=<suggested>
- If the suggestion equals the upper bound, batch by subdirectory instead
- Import per project directory to keep scans under the cap
Example fix
// before $ agentmemory import-jsonl ./sessions warn: Hit the 500-file scan cap; ... Re-run with --max-files=1100 (max 5000)... // after $ agentmemory import-jsonl ./sessions --max-files=1100
Defensive patterns
Strategy: retry
Validate before calling
count=$(find <dir> -name '*.jsonl' | wc -l); [ "$count" -gt 500 ] && echo "use --max-files=$count or higher"
Prevention
- Set --max-files above your expected file count on first import
- Watch for scan-cap warnings and apply the suggested value
- Keep per-directory import sizes predictable
When it happens
Trigger: import-jsonl hits the cap with discovered <= upper and traversal not capped: the walker stopped early at the configured cap.
Common situations: Default cap lower than the project tree size; server accepts more files than the CLI scans by default.
Related errors
AI-assisted analysis of rohitg00/agentmemory@e04ba88819 (2026-08-30).
Data as JSON: /api/errors/aa70581fef4ca1ff.
Report an issue: GitHub.