{"record":{"id":"f2b1c84f01a19b36","repo":"Yeachan-Heo/oh-my-codex","slug":"missing-json-payload-for-runtime-cli-input-json-f2b1c8","errorCode":null,"errorMessage":"Missing JSON payload for ${RUNTIME_CLI_INPUT_JSON_BASE64_FLAG}","messagePattern":"Missing JSON payload for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/runtime-cli.ts","lineNumber":278,"sourceCode":"}\n\nexport function resolveRuntimeCliInlineInput(argv: readonly string[]): string | null {\n  const index = argv.indexOf(RUNTIME_CLI_INPUT_JSON_FLAG);\n  if (index !== -1) {\n    const payload = argv[index + 1];\n    if (typeof payload !== 'string' || payload.trim() === '') {\n      throw new Error(`Missing JSON payload for ${RUNTIME_CLI_INPUT_JSON_FLAG}`);\n    }\n    return payload;\n  }\n\n  const base64Index = argv.indexOf(RUNTIME_CLI_INPUT_JSON_BASE64_FLAG);\n  if (base64Index === -1) {\n    return null;\n  }\n  const payload = argv[base64Index + 1];\n  if (typeof payload !== 'string' || payload.trim() === '') {\n    throw new Error(`Missing JSON payload for ${RUNTIME_CLI_INPUT_JSON_BASE64_FLAG}`);\n  }\n  return Buffer.from(payload.trim(), 'base64url').toString('utf-8');\n}\n\nasync function readRuntimeCliRawInput(argv: readonly string[]): Promise<string> {\n  const inlineInput = resolveRuntimeCliInlineInput(argv);\n  if (inlineInput != null) {\n    return inlineInput.trim();\n  }\n\n  const chunks: Buffer[] = [];\n  for await (const chunk of process.stdin) {\n    chunks.push(chunk as Buffer);\n  }\n  return Buffer.concat(chunks).toString('utf-8').trim();\n}\n\nasync function main(): Promise<void> {","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/runtime-cli.ts#L260-L296","documentation":"Same guard as 865 but for the base64 input flag: the flag was found in argv but the following element is absent or whitespace-only, so there is no base64url payload to decode. Thrown before any Buffer.from decoding attempt.","triggerScenarios":"Passing the base64 flag with no value, followed by another flag, or with an empty string; shell pipelines that emit empty base64 output.","commonSituations":"Automation scripts computing base64 of an empty variable; quoting mistakes; the flag value being consumed by an earlier argv parser.","solutions":["Emit the base64url-encoded JSON immediately after the flag","Ensure the encoded variable is non-empty before spawning (fail early at the caller)","Quote the payload to survive shell word-splitting"],"exampleFix":"// before\nconst args = ['--input-json-base64'];\n// after\nconst args = ['--input-json-base64', Buffer.from(JSON.stringify(payload),'utf-8').toString('base64url')];","handlingStrategy":"validation","validationCode":"const encoded = Buffer.from(JSON.stringify(payload), 'utf-8').toString('base64url');\nif (!encoded) throw new Error('empty payload');\nconst argv = ['--input-json-base64', encoded];","typeGuard":null,"tryCatchPattern":"try { resolveRuntimeCliInlineInput(argv); } catch (e) { if (e instanceof Error && e.message.includes('Missing JSON payload')) { /* rebuild argv with encoded value */ } throw e; }","preventionTips":["Fail early when the value to encode is empty","Never append the flag without its immediately-following value"],"tags":["cli-validation","base64","argv-parsing"],"backgroundTag":"missing-cli-argument-value","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}