{"record":{"id":"3c0261fae02ca0d2","repo":"Yeachan-Heo/oh-my-codex","slug":"invalid-source-missing-value-for-flag","errorCode":null,"errorMessage":"Invalid ${source}: missing value for ${flag}","messagePattern":"Invalid (.+?): missing value for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/team/model-contract.ts","lineNumber":318,"sourceCode":"export function splitWorkerLaunchArgs(raw: string | undefined): string[] {\n  return tokenizeWorkerLaunchArgs(raw).map((token) => token.value);\n}\n\n/** Serialize worker launch arguments for reversible environment transport. */\nexport function serializeTeamWorkerLaunchArgs(args: readonly string[]): string {\n  return args.map((arg) => {\n    if (arg.includes('\\\\')) return `'${arg.replace(/'/g, `'\"'\"'`)}'`;\n    return `\"${arg.replace(/\"/g, '\\\\\"')}\"`;\n  }).join(' ');\n}\n\nfunction parseDirectPolicyValue(\n  value: string | undefined,\n  flag: string,\n  source: string,\n): string {\n  if (typeof value !== 'string') {\n    throw teamWorkerLaunchArgsError(source, `missing value for ${flag}`);\n  }\n  const normalized = value.trim();\n  if (normalized === '' || normalized.startsWith('-')) {\n    throw teamWorkerLaunchArgsError(source, `missing value for ${flag}`);\n  }\n  return value;\n}\n\nfunction setDirectPolicyValue(\n  existingValue: string | null,\n  value: string,\n  axis: PolicyAxis,\n  source: string,\n): string {\n  if (existingValue !== null && existingValue !== value) {\n    throw teamWorkerLaunchArgsError(source, `conflicting duplicate ${axis} policy`);\n  }\n  return value;","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/model-contract.ts#L300-L336","documentation":"A direct policy flag (approval/sandbox) in worker launch args expects a value, but the next token is missing, undefined, empty, or looks like another flag (starts with '-'). parseDirectPolicyValue rejects these as 'missing value'.","triggerScenarios":"Args ending with the flag (--approval), followed by another flag (--approval --sandbox), or followed by an empty string.","commonSituations":"Assuming a flag is boolean rather than value-taking, or a shell expansion swallowing the value ($EMPTY_VAR expanding to nothing).","solutions":["Supply an explicit value: --approval <value>","Use the = form if supported (--approval=<value>)","Check that shell variables used as values are non-empty and don't start with '-'"],"exampleFix":"# before\nexport OMX_TEAM_WORKER_LAUNCH_ARGS='--sandbox'\n# after\nexport OMX_TEAM_WORKER_LAUNCH_ARGS='--sandbox read-only'","handlingStrategy":"validation","validationCode":"function flagHasValue(tokens: string[], i: number): boolean {\n  const v = tokens[i + 1];\n  return typeof v === 'string' && v.trim() !== '' && !v.trim().startsWith('-');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair policy flags with explicit values","Check env-derived values are non-empty before substitution"],"tags":["team","argument-parsing","policy-flags"],"backgroundTag":"invalid-command-line-arguments","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}