-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Bug Report
gitnexus version: 1.3.3
lru-cache version: 11.2.6
Node.js version: 24.0.2
Description
Running gitnexus analyze crashes with:
TypeError: At least one of max, maxSize, or ttl is required
at createASTCache (dist/core/ingestion/ast-cache.js:5:19)
at runPipelineFromRepo (dist/core/ingestion/pipeline.js:113:20)
at async Command.analyzeCommand (dist/cli/analyze.js:166:28)
Root Cause
In pipeline.js, the chunk size is computed as:
const maxChunkFiles = chunks.reduce((max, c) => Math.max(max, c.length), 0);
astCache = createASTCache(maxChunkFiles);When no files match (empty repo, all files filtered out, or chunks happen to be empty), maxChunkFiles is 0. This calls createASTCache(0), which passes max: 0 to new LRUCache(...).
lru-cache v11 treats max: 0 as "not provided" and throws if none of max, maxSize, or ttl are set. This is a breaking behavior change from older versions where max: 0 was silently accepted.
Proposed Fix
In src/core/ingestion/pipeline.ts, ensure the value passed to createASTCache is at least 1:
- astCache = createASTCache(maxChunkFiles);
+ astCache = createASTCache(Math.max(1, maxChunkFiles));The same fix applies to the sequential fallback path where createASTCache(chunkFiles.length) could also be 0:
- astCache = createASTCache(chunkFiles.length);
+ astCache = createASTCache(Math.max(1, chunkFiles.length));Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels