{"record":{"id":"2e5df3571930dbff","repo":"Yeachan-Heo/oh-my-codex","slug":"missing-json-value-after-input-2e5df3","errorCode":null,"errorMessage":"Missing JSON value after --input","messagePattern":"Missing JSON value after --input","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/state.ts","lineNumber":104,"sourceCode":"  if (isHelpArg(args[1])) {\n    stdout(STATE_HELP);\n    return;\n  }\n\n  let inputValue: string | undefined;\n  let inputFileValue: string | undefined;\n  let modeValue: string | undefined;\n  let json = false;\n  for (let index = 1; index < args.length; index += 1) {\n    const arg = args[index];\n    if (arg === '--json') {\n      json = true;\n      continue;\n    }\n    if (arg === '--input') {\n      const next = args[index + 1];\n      if (!next) {\n        throw new Error('Missing JSON value after --input');\n      }\n      inputValue = next;\n      index += 1;\n      continue;\n    }\n    if (arg.startsWith('--input=')) {\n      inputValue = arg.slice('--input='.length);\n      continue;\n    }\n    if (arg === '--input-file') {\n      const next = args[index + 1];\n      if (!next) {\n        throw new Error('Missing path value after --input-file');\n      }\n      inputFileValue = next;\n      index += 1;\n      continue;\n    }","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/state.ts#L86-L122","documentation":"The --input flag appeared as the last token of the state command's argument list, so there is no JSON value following it. Both the space form and --input= exist; this error covers the space form without a value.","triggerScenarios":"`state set --input` with nothing after it, often from an empty shell variable expansion ending the command.","commonSituations":"`state set --input \"$JSON\"` where JSON is empty/unset and the shell drops the token; truncated command lines in scripts.","solutions":["Follow --input with the JSON: `state set --input '{\"a\":1}'`","Guard the variable: `: \"${JSON:?JSON required}\"` before invoking","Or use --input-file to avoid inline quoting entirely"],"exampleFix":"# before\nstate set --input  # $JSON was empty\n# after\nJSON='{\"a\":1}'\nstate set --input \"$JSON\"","handlingStrategy":"validation","validationCode":"if (!json || json.trim().length === 0) {\n  throw new Error('refusing to run: --input value is empty');\n}\nspawn('state', ['set', '--input', json]);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use `: ${JSON:?}` guards so empty vars fail early","Pass args programmatically (execFile) instead of shell interpolation"],"tags":["cli","json","argument-validation"],"backgroundTag":"missing-cli-argument","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}