{"record":{"id":"c2db03644d49d36f","repo":"Egonex-AI/Understand-Anything","slug":"retry-batching-failed-batching-error-batchin","errorCode":null,"errorMessage":"Retry batching failed: ${batching.error ?? batching.status}","messagePattern":"Retry batching failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"understand-anything-plugin/skills/understand/prepare-symbol-retry.mjs","lineNumber":47,"sourceCode":"      throw new Error('Symbol retry already used for these commits; stop without advancing the baseline');\n    }\n  }\n  // Do not trust an old report or a caller-supplied list of files to replace.\n  const report = await validateIncrementalSymbols(projectRoot, { intermediateDir });\n  if (report.ok || report.unresolvedFiles.length === 0) {\n    throw new Error('No unresolved symbol files eligible for a targeted retry; inspect the symbol report');\n  }\n  const paths = new Set(report.unresolvedFiles);\n  const changedFilesPath = join(intermediateDir, 'incremental-symbol-retry-files.json');\n  const batchesPath = join(intermediateDir, 'incremental-symbol-retry-batches.json');\n  atomicWriteJson(changedFilesPath, [...paths]);\n  const skillDir = dirname(fileURLToPath(import.meta.url));\n  const batching = spawnSync(process.execPath, [\n    join(skillDir, 'compute-batches.mjs'), projectRoot,\n    `--changed-files=${changedFilesPath}`, `--output=${batchesPath}`,\n  ], { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });\n  if (batching.stderr) process.stderr.write(batching.stderr);\n  if (batching.status !== 0) throw new Error(`Retry batching failed: ${batching.error ?? batching.status}`);\n  const batches = readJson(batchesPath).batches;\n  const scheduled = batches.flatMap(batch => batch.files.map(file => file.path));\n  if (JSON.stringify([...scheduled].sort()) !== JSON.stringify([...paths].sort())) {\n    throw new Error('Retry batches do not cover exactly the affected files');\n  }\n  for (const batch of batches) {\n    if (!Number.isInteger(batch.batchIndex) || batch.batchIndex < 1) throw new Error('Invalid retry batch index');\n    const files = new Set(batch.files.map(file => file.path));\n    batch.previousSymbols = baseline.files.filter(file => files.has(file.filePath)).flatMap(file =>\n      file.nodes.filter(symbolKind).map(node => {\n        const parents = new Set(file.edges.filter(edge => edge.type === 'contains' && edge.target === node.id)\n          .map(edge => edge.source));\n        const owners = file.nodes.filter(parent => parent.type === 'class' && parents.has(parent.id))\n          .map(parent => parent.name);\n        return {\n          id: node.id, name: node.name, type: node.type, filePath: node.filePath,\n          ...(node.lineRange ? { lineRange: node.lineRange } : {}),\n          ...(owners.length ? { owners } : {}),","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/Egonex-AI/Understand-Anything/blob/07edf82a04371b6f69779b067bdc8a1a8753a9db/understand-anything-plugin/skills/understand/prepare-symbol-retry.mjs#L29-L65","documentation":"The script spawns compute-batches.mjs as a child process to batch the retry files. If the child exits with a non-zero status, it throws this error embedding batching.error (spawn-level failure, e.g. ENOENT) or the numeric exit status. Child stderr is forwarded before throwing to aid diagnosis.","triggerScenarios":"compute-batches.mjs crashes or exits non-zero: a bug in batching logic, unreadable intermediate inputs (changed-files JSON), a thrown error inside the child, or spawn failure (missing script file, ENOENT on the interpreter).","commonSituations":"Corrupt or missing incremental-symbol-retry-files.json input; compute-batches.mjs failing on a malformed file entry; script moved/renamed so join(skillDir, 'compute-batches.mjs') points nowhere; memory/timeout kill yielding a signal-derived status.","solutions":["Read the stderr printed just before the error — it contains the child's actual failure message.","Verify compute-batches.mjs exists next to prepare-symbol-retry.mjs and that the plugin install is intact (reinstall/re-copy the plugin if missing).","Check the input file incremental-symbol-retry-files.json in the intermediate dir is valid JSON with the expected path array.","Run compute-batches.mjs manually with the same arguments to reproduce and debug the child failure."],"exampleFix":"// before\n$ node compute-batches.mjs . --changed-files=... \nError: cannot read input (missing incremental-symbol-retry-files.json)\n// after: ensure prepare-symbol-retry ran its write step, then retry\nls .ua/intermediate/incremental-symbol-retry-files.json  # must exist\nnode prepare-symbol-retry.mjs .","handlingStrategy":"try-catch","validationCode":"import { existsSync } from 'node:fs';\nimport { join, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nconst skillDir = dirname(fileURLToPath(import.meta.url));\nif (!existsSync(join(skillDir, 'compute-batches.mjs'))) {\n  throw new Error('compute-batches.mjs missing; reinstall the plugin');\n}","typeGuard":null,"tryCatchPattern":"const batching = spawnSync(process.execPath, [batchScript, projectRoot, ...args], { encoding: 'utf8' });\nif (batching.error) throw new Error(`Batching spawn failed: ${batching.error.message}`);\nif (batching.stderr) process.stderr.write(batching.stderr);\nif (batching.status !== 0) {\n  throw new Error(`Retry batching failed (exit ${batching.status}); see stderr above`);\n}","preventionTips":["Keep the whole skill directory intact — don't copy prepare-symbol-retry.mjs alone.","Validate intermediate input JSON files before spawning the batcher.","Reproduce child failures by running compute-batches.mjs manually with the same args."],"tags":["child-process","batching","spawn","retry"],"backgroundTag":"git-command-failed","analyzedSha":"07edf82a04371b6f69779b067bdc8a1a8753a9db","analyzedAt":"2026-09-07T23:20:10.829Z","contentChangedAt":"2026-09-07T23:20:10.829Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}