{"record":{"id":"a4dfc993987d0ef0","repo":"rohitg00/agentmemory","slug":"basemsg-tree-exceeds-the-server-s-max-files-l","errorCode":null,"errorMessage":"${baseMsg} Tree exceeds the server's --max-files limit of ${upper}; batch by subdirectory (run import-jsonl once per project under ~/.claude/projects).","messagePattern":"(.+?) Tree exceeds the server's --max-files limit of (.+?); batch by subdirectory \\(run import-jsonl once per project under ~/\\.claude/projects\\)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cli.ts","lineNumber":3803,"sourceCode":"      process.exit(1);\n    }\n    spinner.stop(\n      `imported ${json.imported ?? 0} file(s), ${json.observations ?? 0} observation(s) across ${json.sessionIds?.length || 0} session(s)`,\n    );\n    if (json.truncated) {\n      const cap = json.maxFiles ?? 200;\n      const upper = json.maxFilesUpperBound ?? 1000;\n      const discovered = json.discovered ?? 0;\n      const skipped = discovered - (json.imported ?? 0);\n      const discoveredLabel = json.traversalCapped\n        ? `${discovered}+ (traversal halted at safety cap)`\n        : String(discovered);\n      const baseMsg = `Hit the ${cap}-file scan cap; ${skipped} of ${discoveredLabel} discovered file(s) were skipped.`;\n      // If we already saw more than the server's hard cap (or the\n      // walker stopped early), bumping --max-files won't help on its\n      // own — recommend batching by subdirectory.\n      if (discovered > upper || json.traversalCapped) {\n        p.log.warn(\n          `${baseMsg} Tree exceeds the server's --max-files limit of ${upper}; ` +\n            `batch by subdirectory (run import-jsonl once per project under ~/.claude/projects).`,\n        );\n      } else {\n        const suggested = Math.min(\n          Math.max((discovered || cap) + 100, cap * 2),\n          upper,\n        );\n        p.log.warn(\n          `${baseMsg} Re-run with --max-files=${suggested} (max ${upper}) or batch by subdirectory.`,\n        );\n      }\n    }\n    if (json.sessionIds && json.sessionIds.length > 0) {\n      p.log.info(`View at ${getViewerUrl()} → Replay tab`);\n    }\n  } catch (err) {\n    spinner.stop(\"failed\");","sourceCodeStart":3785,"sourceCodeEnd":3821,"githubUrl":"https://github.com/rohitg00/agentmemory/blob/e04ba88819c365c9acf9d6661ea802143e728bd6/src/cli.ts#L3785-L3821","documentation":"Post-import warning when the JSONL import hit the file-scan cap AND the tree itself exceeds the server's hard --max-files limit (or the walker reported it was capped). The CLI explains that raising --max-files alone cannot help and recommends batching imports per subdirectory.","triggerScenarios":"import-jsonl reports json.traversalCapped, or discovered file count > server upper bound, after hitting the scan cap.","commonSituations":"Very large ~/.claude/projects trees with thousands of session files; running against the whole projects root instead of per project; server started with a low max-files while the tree is huge.","solutions":["Run import-jsonl once per project directory under ~/.claude/projects instead of the whole tree","Restart the server with a higher --max-files if you truly need a single big scan","Prune/archive old session JSONL files to shrink the tree"],"exampleFix":"// before\n$ agentmemory import-jsonl ~/.claude/projects\nwarn: Hit the 500-file scan cap... Tree exceeds the server's --max-files limit...\n// after\n$ for d in ~/.claude/projects/*/; do agentmemory import-jsonl \"$d\"; done","handlingStrategy":"fallback","validationCode":"count=$(find ~/.claude/projects -name '*.jsonl' | wc -l); echo \"discovered=$count — batch per project if count exceeds server --max-files\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Import per project directory, not the whole projects root","Size the server's --max-files to your largest tree","Archive old session files periodically"],"tags":["import","limits","file-scan"],"backgroundTag":"file-limit-exceeded","analyzedSha":"e04ba88819c365c9acf9d6661ea802143e728bd6","analyzedAt":"2026-08-30T01:07:40.754Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}