{"record":{"id":"36d1992bb3175b45","repo":"paperclipai/paperclip","slug":"missing-name","errorCode":null,"errorMessage":"missing ${name}","messagePattern":"missing (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/src/cli/eval-session.ts","lineNumber":45,"sourceCode":"} from \"../live/live-session.js\";\nimport {\n  evalSessionUsage,\n  expectedEvalSessionDriver,\n  parseEvalSessionRequest,\n  type EvalSessionRequest,\n  type EvalSessionUsage,\n} from \"./eval-session-contract.js\";\nimport { evalProviderTransportOptions } from \"./eval-provider-runtime.js\";\n\ninterface 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> {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/src/cli/eval-session.ts#L27-L63","documentation":"The argument() helper in eval-session.ts (lines 31-36) parses CLI flags of the form --flag <value> for the eval-session CLI entrypoint. It throws 'missing <name>' when the flag has no following token, the following token is itself another --flag, or the value is an empty string. Values are then passed through path resolve(). It is raised by parseEvalSessionCliArgs for --request and --output.","triggerScenarios":"Running the eval-session CLI as `--request --output out.json` (value consumed as a flag), `--request` with nothing after it, `--request \"\"`, or a path that literally begins with '--' (e.g. '--request --weird-dir/x.json').","commonSituations":"Forgetting the value for a flag; quoting mistakes in shell scripts leaving an empty argument; paths starting with dashes; reordering flags so one flag's value slot is filled by the next flag name.","solutions":["Supply a value after each flag: eval-session --request /path/to/request.json --output /path/to/out.json.","Quote the path and, if it starts with '-', use './-prefixed' or an absolute path so it doesn't look like a flag.","Check shell quoting/variable expansion — an unset variable can collapse to an empty argument.","Inspect the exact argv passed to the CLI in the calling script; fix the flag/value pairing."],"exampleFix":"// before (shell)\nnode eval-session.js --request --output out.json\n// after\nnode eval-session.js --request ./request.json --output out.json","handlingStrategy":"validation","validationCode":"function assertCliArgs(args: string[]): void {\n  const allowed = new Set([\"--request\", \"--output\"]);\n  for (let i = 0; i < args.length; i += 2) {\n    const flag = args[i];\n    const value = args[i + 1];\n    if (!allowed.has(flag)) throw new Error(`unknown argument: ${flag}`);\n    if (value === undefined || value === \"\" || value.startsWith(\"--\")) {\n      throw new Error(`missing ${flag}`);\n    }\n  }\n}","typeGuard":"function hasFlagValue(args: string[], flag: string): boolean {\n  const i = args.indexOf(flag);\n  const value = i < 0 ? undefined : args[i + 1];\n  return typeof value === \"string\" && value.length > 0 && !value.startsWith(\"--\");\n}","tryCatchPattern":"try {\n  const opts = parseEvalSessionCliArgs(process.argv.slice(2));\n  // proceed\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"missing \")) {\n    console.error(`Usage: eval-session --request <request.json> --output <out.json> (${err.message})`);\n    process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Always pass both flags with explicit values in one place (a script or Makefile target).","Quote paths and use absolute or ./-prefixed paths so leading dashes aren't mistaken for flags.","In shell wrappers, check that variables holding paths are non-empty before invoking the CLI.","Keep flag pairs adjacent — never reorder so a flag name lands in a value slot."],"tags":["cli","arguments","config"],"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-14T05:17:10.506Z"}