Yeachan-Heo/oh-my-codex · error

Invalid OMX_TEAM_WORKER_LAUNCH_ARGS: unterminated quote

Error message

Invalid OMX_TEAM_WORKER_LAUNCH_ARGS: unterminated quote

What it means

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.

Source

Thrown at src/team/model-contract.ts:258

      tokenStarted = true;
      continue;
    }
    if (character === '"') {
      quote = 'double';
      tokenStarted = true;
      continue;
    }
    if (character === '\\') {
      token += character;
      tokenStarted = true;
      continue;
    }
    token += character;
    tokenStarted = true;
  }

  if (quote !== null) {
    throw teamWorkerLaunchArgsError('OMX_TEAM_WORKER_LAUNCH_ARGS', 'unterminated quote');
  }
  if (tokenStarted) pushToken(raw.length);
  return args;
}

function extractExactEnvironmentReasoningOverride(raw: string | undefined): string | null {
  const tokens = tokenizeWorkerLaunchArgs(raw);
  let reasoningOverride: string | null = null;

  for (let index = 0; index < tokens.length; index += 1) {
    const token = tokens[index]!;
    if (token.value === '--') break;
    if (token.value !== CONFIG_FLAG) continue;

    const configValue = tokens[index + 1];
    if (!configValue) continue;
    index += 1;
    if (!isReasoningOverride(configValue.value)) continue;

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Balance the quotes: add the matching closing quote
  2. In shell, prefer single-quoting the whole value when it contains double quotes
  3. Log the raw env value before parsing to spot the unbalanced quote

Example fix

# before
export OMX_TEAM_WORKER_LAUNCH_ARGS='--label "worker one'
# after
export OMX_TEAM_WORKER_LAUNCH_ARGS='--label "worker one"'
Defensive patterns

Strategy: try-catch

Validate before calling

function hasBalancedQuotes(raw: string): boolean {
  let q: string | null = null;
  for (const ch of raw) {
    if (q) { if (ch === q) q = null; }
    else if (ch === '"' || ch === "'") q = ch;
  }
  return q === null;
}

Try / catch

try { splitWorkerLaunchArgs(raw); } catch (e) { if (String(e).includes('unterminated quote')) { /* re-prompt for corrected env var */ } else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/c4351559fb492156. Report an issue: GitHub.