{"record":{"id":"c4351559fb492156","repo":"Yeachan-Heo/oh-my-codex","slug":"invalid-omx-team-worker-launch-args-unterminated","errorCode":null,"errorMessage":"Invalid OMX_TEAM_WORKER_LAUNCH_ARGS: unterminated quote","messagePattern":"Invalid OMX_TEAM_WORKER_LAUNCH_ARGS: unterminated quote","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/team/model-contract.ts","lineNumber":258,"sourceCode":"      tokenStarted = true;\n      continue;\n    }\n    if (character === '\"') {\n      quote = 'double';\n      tokenStarted = true;\n      continue;\n    }\n    if (character === '\\\\') {\n      token += character;\n      tokenStarted = true;\n      continue;\n    }\n    token += character;\n    tokenStarted = true;\n  }\n\n  if (quote !== null) {\n    throw teamWorkerLaunchArgsError('OMX_TEAM_WORKER_LAUNCH_ARGS', 'unterminated quote');\n  }\n  if (tokenStarted) pushToken(raw.length);\n  return args;\n}\n\nfunction extractExactEnvironmentReasoningOverride(raw: string | undefined): string | null {\n  const tokens = tokenizeWorkerLaunchArgs(raw);\n  let reasoningOverride: string | null = null;\n\n  for (let index = 0; index < tokens.length; index += 1) {\n    const token = tokens[index]!;\n    if (token.value === '--') break;\n    if (token.value !== CONFIG_FLAG) continue;\n\n    const configValue = tokens[index + 1];\n    if (!configValue) continue;\n    index += 1;\n    if (!isReasoningOverride(configValue.value)) continue;","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/model-contract.ts#L240-L276","documentation":"The OMX_TEAM_WORKER_LAUNCH_ARGS environment variable contains a quoted token that is never closed. The shell-like tokenizer in model-contract.ts tracks quote state and rejects leftover open quotes at end of input.","triggerScenarios":"A value such as `--label \"worker one` or `--prompt 'hello` where the closing double or single quote is missing, passed via env or inherited launch args.","commonSituations":"Manually writing env vars in shell with unbalanced quotes, or programmatic construction that drops a closing quote, or shell escaping being consumed by an outer shell (var=\"--x \\\"a\" losing a quote).","solutions":["Balance the quotes: add the matching closing quote","In shell, prefer single-quoting the whole value when it contains double quotes","Log the raw env value before parsing to spot the unbalanced quote"],"exampleFix":"# before\nexport OMX_TEAM_WORKER_LAUNCH_ARGS='--label \"worker one'\n# after\nexport OMX_TEAM_WORKER_LAUNCH_ARGS='--label \"worker one\"'","handlingStrategy":"try-catch","validationCode":"function hasBalancedQuotes(raw: string): boolean {\n  let q: string | null = null;\n  for (const ch of raw) {\n    if (q) { if (ch === q) q = null; }\n    else if (ch === '\"' || ch === \"'\") q = ch;\n  }\n  return q === null;\n}","typeGuard":null,"tryCatchPattern":"try { splitWorkerLaunchArgs(raw); } catch (e) { if (String(e).includes('unterminated quote')) { /* re-prompt for corrected env var */ } else throw e; }","preventionTips":["Single-quote the whole env var in shell","Write a preflight check that calls splitWorkerLaunchArgs and reports errors early"],"tags":["team","env-var","argument-parsing","quoting"],"backgroundTag":"invalid-env-var","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}