{"record":{"id":"8268f8990089d7cb","repo":"Egonex-AI/Understand-Anything","slug":"usage-node-prepare-symbol-retry-mjs-projectroot","errorCode":null,"errorMessage":"Usage: node prepare-symbol-retry.mjs <projectRoot>","messagePattern":"Usage: node prepare-symbol-retry\\.mjs <projectRoot>","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"understand-anything-plugin/skills/understand/prepare-symbol-retry.mjs","lineNumber":18,"sourceCode":"#!/usr/bin/env node\n/** Prepare exactly one targeted analyzer retry after the symbol gate fails. */\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { existsSync, readdirSync, realpathSync, unlinkSync } from 'node:fs';\nimport { spawnSync } from 'node:child_process';\nimport {\n  atomicWriteJson,\n  getIntermediateDir,\n  loadSymbolContext,\n  normalizePath,\n  readJson,\n  symbolKind,\n  validateIncrementalSymbols,\n} from './validate-incremental-symbols.mjs';\n\nasync function main() {\n  if (process.argv.length !== 3) throw new Error('Usage: node prepare-symbol-retry.mjs <projectRoot>');\n  const projectRoot = realpathSync(process.argv[2]);\n  const intermediateDir = await getIntermediateDir(projectRoot);\n  const { plan, baseline } = loadSymbolContext(projectRoot, intermediateDir);\n  if (!['PARTIAL_UPDATE', 'ARCHITECTURE_UPDATE'].includes(plan.action)) {\n    throw new Error('Symbol retry requires a partial or architecture incremental update');\n  }\n  const retryPath = join(intermediateDir, 'incremental-symbol-retry.json');\n  if (existsSync(retryPath)) {\n    const retry = readJson(retryPath);\n    if (retry.baseCommit === plan.baseCommit && retry.headCommit === plan.headCommit && retry.attempt === 1) {\n      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  }","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/Egonex-AI/Understand-Anything/blob/07edf82a04371b6f69779b067bdc8a1a8753a9db/understand-anything-plugin/skills/understand/prepare-symbol-retry.mjs#L1-L36","documentation":"prepare-symbol-retry.mjs is a CLI script that prepares a targeted symbol-level retry for a failed incremental update. main() requires exactly one argument (the project root) and throws this usage error when process.argv.length !== 3, i.e. the wrong number of CLI arguments was supplied.","triggerScenarios":"Running the script with zero arguments, with more than one argument, or via a wrapper that injects unexpected extra argv entries (e.g. node prepare-symbol-retry.mjs or node prepare-symbol-retry.mjs . --flag).","commonSituations":"Typo in invocation from a runbook; passing flags the script doesn't support; calling from npm scripts where extra args need a `--` separator; forgetting the project root argument entirely.","solutions":["Invoke with exactly one argument: node prepare-symbol-retry.mjs <projectRoot>.","When passing args through npm/pnpm scripts, use the -- separator: pnpm prepare-symbol-retry -- .","Ensure the project root is a valid path — it is passed through realpathSync next, so use an absolute or correct relative path."],"exampleFix":"// before\nnode prepare-symbol-retry.mjs\n// Error: Usage: node prepare-symbol-retry.mjs <projectRoot>\n// after\nnode prepare-symbol-retry.mjs /path/to/project","handlingStrategy":"validation","validationCode":"if (process.argv.length !== 3) {\n  console.error('Usage: node prepare-symbol-retry.mjs <projectRoot>');\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runRetry(projectRoot);\n} catch (e) {\n  if (e.message.startsWith('Usage: node prepare-symbol-retry.mjs')) {\n    console.error(e.message);\n    process.exitCode = 2;\n  } else throw e;\n}","preventionTips":["Wrap script invocations in shell/npm wrappers that enforce the argument count.","Use `--` separators when forwarding args through pnpm/npm scripts.","Document the exact invocation in runbooks/CI config."],"tags":["cli","usage","arguments"],"backgroundTag":"invalid-cli-argument","analyzedSha":"07edf82a04371b6f69779b067bdc8a1a8753a9db","analyzedAt":"2026-09-07T23:20:10.829Z","contentChangedAt":"2026-09-07T23:20:10.829Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}