{"record":{"id":"73fc754baf33ed23","repo":"abhigyanpatwari/GitNexus","slug":"parsedfile-cache-could-not-reset-durable-chunk-ge","errorCode":null,"errorMessage":"parsedfile-cache: could not reset durable chunk generation; continuing","messagePattern":"parsedfile-cache: could not reset durable chunk generation; continuing","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"gitnexus/src/core/ingestion/pipeline-phases/parse-impl.ts","lineNumber":1121,"sourceCode":"            logger.info(\n              `📦 parse-cache SKIP: chunk ${p.chunkIdx + 1}/${numChunks} ` +\n                `had ${quarantinedInChunk} worker-quarantined file(s); ` +\n                `next run will rediscover (${p.chunkHash.slice(0, 8)})`,\n            );\n          }\n        } else if (rawResults.length > 0) {\n          await persistParseCacheChunk(parseCache, p.chunkHash, rawResults);\n          if (isDev) {\n            logger.info(\n              `📦 parse-cache MISS+store: chunk ${p.chunkIdx + 1}/${numChunks} (${p.chunkFiles.length} files, ${p.chunkHash.slice(0, 8)})`,\n            );\n          }\n        }\n      }\n      await applyChunkResults(chunkWorkerData, p.chunkIdx, p.chunkFiles.length, p.chunkStartMs);\n    };\n\n    /**\n     * Dispatch a round's cache misses as ONE pool round. Returns the parked\n     * round; the caller drains it after starting the next one so the workers\n     * parse round N+1 while the main thread merges round N (the same overlap\n     * the per-chunk loop had, at round granularity).\n     */\n    const startRound = async (\n      entries: RoundEntry[],\n    ): Promise<{ entries: RoundEntry[]; results: Promise<ParseWorkerResult[][]> } | null> => {\n      if (entries.length === 0) return null;\n      const misses = entries.filter((entry) => entry.kind === 'miss');\n      if (misses.length === 0) {\n        return { entries, results: Promise.resolve([]) };\n      }\n      // Each chunk resets its own directory, so these are independent and run\n      // concurrently: serially they would sit on the critical path this round\n      // exists to shorten, with the pool idle and the previous round's merge\n      // waiting, once per miss.\n      //","sourceCodeStart":1103,"sourceCodeEnd":1139,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/core/ingestion/pipeline-phases/parse-impl.ts#L1103-L1139","documentation":"With the durable parsed-file cache enabled, the parse phase stores each chunk's raw worker results on disk keyed by chunk hash. On a cache miss it calls prepareDurableParsedFileChunk(durableParsedFileDir, chunkHash) to reset that chunk's directory before workers write a fresh generation; if that reset throws (permissions, ENOSPC, stale lock, directory removed concurrently), the catch warns 'parsedfile-cache: could not reset durable chunk generation; continuing' and the analyze proceeds — the cache is an optimization, workers recreate the directory on write, and at worst the old generation lingers.","triggerScenarios":"The durable cache directory being unwritable (EACCES/EPERM, read-only mount), the disk being full (ENOSPC), a stale lock/ownership left by a previous run under another user, or the cache being wiped while the analyze runs.","commonSituations":"CI pipelines mounting a cache volume read-only or root-owned; cache dir created by root then reused by a non-root user; disk pressure on the cache drive; cache cleaned concurrently by another job.","solutions":["Check the logged { err } — EACCES/EPERM points to permissions, ENOSPC to disk space","chown/chmod the durable cache directory so the indexing user can write it","Free disk space or move the cache to a volume with headroom","Delete the stale chunk generation (the warn includes the chunkHash prefix) or clear the cache once","Otherwise ignore it — analyze results are unaffected; only cache freshness for this run degrades"],"exampleFix":"# before: cache dir owned by root, analyze runs as ci-user -> EACCES warn\nchown -R root:root <durable-parsedfile-dir>  # wrong owner\n\n# after: hand the cache to the indexing user, then re-run\nchown -R ci-user:ci-user <durable-parsedfile-dir> && npx gitnexus analyze","handlingStrategy":"fallback","validationCode":"// preflight before analyze: writable cache dir with free space\nimport fs from 'node:fs';\nfs.accessSync(durableParsedFileDir, fs.constants.W_OK); // throws EACCES early, with a clear cause\nassertFreeSpace(durableParsedFileDir, 512 * 1024 * 1024);","typeGuard":null,"tryCatchPattern":"try {\n  await prepareDurableParsedFileChunk(durableParsedFileDir, chunkHash);\n} catch (err) {\n  logger.warn({ err, chunkHash: chunkHash.slice(0, 8) }, 'parsedfile-cache: could not reset durable chunk generation; continuing');\n}","preventionTips":["Own the durable cache directory with the same user that runs analyze","Do not mount the cache volume read-only in CI","Monitor disk space on the cache drive (ENOSPC is the other common cause)","Treat this warn as cache-only: analyze correctness is unaffected"],"tags":["cache","filesystem","permissions","disk-full","ingestion"],"backgroundTag":"disk-cache-write-failed","analyzedSha":"ac9a4e9abd8fd3058c070b72c23402a4f887929a","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}