{"record":{"id":"aa70581fef4ca1ff","repo":"rohitg00/agentmemory","slug":"basemsg-re-run-with-max-files-suggested-m","errorCode":null,"errorMessage":"${baseMsg} Re-run with --max-files=${suggested} (max ${upper}) or batch by subdirectory.","messagePattern":"(.+?) Re-run with --max-files=(.+?) \\(max (.+?)\\) or batch by subdirectory\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cli.ts","lineNumber":3812,"sourceCode":"      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\");\n    if (err instanceof Error && err.name === \"TimeoutError\") {\n      p.log.error(\"import timed out after 2 minutes\");\n    } else {\n      p.log.error(err instanceof Error ? err.message : String(err));\n    }\n    process.exit(1);\n  }\n}\n","sourceCodeStart":3794,"sourceCodeEnd":3830,"githubUrl":"https://github.com/rohitg00/agentmemory/blob/e04ba88819c365c9acf9d6661ea802143e728bd6/src/cli.ts#L3794-L3830","documentation":"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.","triggerScenarios":"import-jsonl hits the cap with discovered <= upper and traversal not capped: the walker stopped early at the configured cap.","commonSituations":"Default cap lower than the project tree size; server accepts more files than the CLI scans by default.","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"],"exampleFix":"// before\n$ agentmemory import-jsonl ./sessions\nwarn: Hit the 500-file scan cap; ... Re-run with --max-files=1100 (max 5000)...\n// after\n$ agentmemory import-jsonl ./sessions --max-files=1100","handlingStrategy":"retry","validationCode":"count=$(find <dir> -name '*.jsonl' | wc -l); [ \"$count\" -gt 500 ] && echo \"use --max-files=$count or higher\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"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"}