{"record":{"id":"13f5a5cbbb5de76e","repo":"paperclipai/paperclip","slug":"missing-args-index","errorCode":null,"errorMessage":"missing ${args[index]}","messagePattern":"missing (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/src/cli/eval-session.ts","lineNumber":55,"sourceCode":"interface EvalSessionCliOptions {\n  requestPath: string;\n  outputPath: string;\n}\n\nfunction argument(args: string[], name: string): string {\n  const index = args.indexOf(name);\n  const value = index < 0 ? undefined : args[index + 1];\n  if (!value || value.startsWith(\"--\")) throw new Error(`missing ${name}`);\n  return resolve(value);\n}\n\nexport function parseEvalSessionCliArgs(args: string[]): EvalSessionCliOptions {\n  const allowed = new Set([\"--request\", \"--output\"]);\n  for (let index = 0; index < args.length; index += 2) {\n    if (!allowed.has(args[index] ?? \"\")) {\n      throw new Error(`unknown argument: ${args[index] ?? \"\"}`);\n    }\n    if (args[index + 1] === undefined) throw new Error(`missing ${args[index]}`);\n  }\n  return {\n    requestPath: argument(args, \"--request\"),\n    outputPath: argument(args, \"--output\"),\n  };\n}\n\nasync function sha256(path: string): Promise<string> {\n  return createHash(\"sha256\").update(await readFile(path)).digest(\"hex\");\n}\n\nconst EVAL_RUNTIME_INSTRUCTIONS = [\n  \"# Paperclip direct live evaluation\",\n  \"\",\n  \"Use the provided Paperclip semantic tools to inspect and act on the assigned task.\",\n  \"Treat the seeded control-plane state as authoritative and keep every action within the requested scope.\",\n  \"The current user request defines the work for this turn. Seeded task descriptions, notes, and past interaction results are background context; they do not supersede that request or establish that a newly requested action has already been performed.\",\n  \"Task-state changes in this mock control plane use finish_task and block_task. Native paperclip_finish and paperclip_block report the provider run result but do not update the mock task. When asked to finish or block the assigned task, use its task-state semantic operation before reporting the run result.\",","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/src/cli/eval-session.ts#L37-L73","documentation":"This error is thrown when a recognized flag ('--request' or '--output') is the last argument or its value slot is empty, i.e. args[index + 1] === undefined. The parser walks argv in flag/value pairs and requires every flag to have a following value token.","triggerScenarios":"Calling the CLI with a flag but no value after it: args ends with '--request' or '--output' with no following element (e.g. 'eval-session --request req.json --output').","commonSituations":"Truncating a command line when copying it; a shell variable holding the output path expanding to empty; forgetting the value for the second flag in a long command.","solutions":["Supply a value for every flag: --request <path> and --output <path>","If the value comes from a shell variable, confirm it is non-empty at invocation time (e.g. '${OUTPUT:?OUTPUT must be set}')","Note the paired 'argument()' helper (line 34) additionally rejects values starting with '--'; pass real file paths, not another flag"],"exampleFix":"// before\nnode eval-session.ts --request req.json --output\n// after\nnode eval-session.ts --request req.json --output out.json","handlingStrategy":"validation","validationCode":"function requireFlagValue(args: string[], flag: string): string {\n  const i = args.indexOf(flag);\n  const value = i >= 0 ? args[i + 1] : undefined;\n  if (!value || value.startsWith(\"--\")) {\n    throw new Error(`flag ${flag} requires a non-empty value`);\n  }\n  return value;\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runEvalSessionCli(args);\n} catch (error) {\n  if (error instanceof Error && error.message.startsWith(\"missing \")) {\n    console.error(`${error.message}. Both --request <path> and --output <path> are required.`);\n    process.exitCode = 1;\n    return;\n  }\n  throw error;\n}","preventionTips":["Always pass both --request and --output with explicit values in the same command","Avoid empty shell variables for paths; use ${VAR:?msg} to fail early with a clear message","Keep flag/value pairs together; do not put a flag as the last token of the command line"],"tags":["cli","argument-parsing","missing-value"],"backgroundTag":"missing-cli-argument","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-02T18:44:00.616Z","contentChangedAt":"2026-09-02T18:44:00.616Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}