Yeachan-Heo/oh-my-codex · error

Invalid ${source}: missing value for ${configFlag}

Error message

Invalid ${source}: missing value for ${configFlag}

What it means

A config flag (-c/--config or long form) in worker launch args is missing its value: the following token is undefined, empty, or starts with '-'. Thrown by parseTeamWorkerLaunchArgs unless directPolicyMode is 'ignore'.

Source

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

      } else {
        sandboxValue = setDirectPolicyValue(sandboxValue, value, 'sandbox', source);
      }
      continue;
    }

    const config = configSelector(arg);
    if (config) {
      const splitConfig = config.value === undefined;
      const configValue = splitConfig ? args[i + 1] : config.value;
      const configValueMissing = typeof configValue !== 'string'
        || configValue.trim() === ''
        || configValue.trim().startsWith('-');
      if (configValueMissing) {
        if (options.directPolicyMode === 'ignore') continue;
        const configFlag = arg === LONG_CONFIG_FLAG || arg.startsWith(`${LONG_CONFIG_FLAG}=`)
          ? LONG_CONFIG_FLAG
          : CONFIG_FLAG;
        throw teamWorkerLaunchArgsError(source, `missing value for ${configFlag}`);
      }
      if (splitConfig) i += 1;

      const configPolicy = typeof configValue === 'string' ? extractConfigPolicyAssignment(configValue) : null;
      if (configPolicy) {
        if (options.directPolicyMode === 'ignore') continue;

        const flag = configPolicy.axis === 'approval' ? TEAM_WORKER_APPROVAL_FLAG : TEAM_WORKER_SANDBOX_FLAG;
        const value = parseDirectPolicyValue(configPolicy.value, flag, source);
        if (configPolicy.axis === 'approval') {
          approvalValue = setDirectPolicyValue(approvalValue, value, 'approval', source);
        } else {
          sandboxValue = setDirectPolicyValue(sandboxValue, value, 'sandbox', source);
        }
        continue;
      }

      if (arg === CONFIG_FLAG && splitConfig && typeof configValue === 'string') {

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Append the config file path after the flag: --config /path/to/config
  2. Verify the config path variable is set and non-empty
  3. Use --config=path form with a non-empty path

Example fix

# before
export OMX_TEAM_WORKER_LAUNCH_ARGS='--config'
# after
export OMX_TEAM_WORKER_LAUNCH_ARGS='--config=/etc/omx/worker.json'
Defensive patterns

Strategy: validation

Validate before calling

function configFlagHasValue(tokens: string[], i: number, expectsValue: boolean): boolean {
  if (!expectsValue) return true;
  const v = tokens[i + 1];
  return typeof v === 'string' && v.trim() !== '' && !v.trim().startsWith('-');
}

Try / catch

try { parseTeamWorkerLaunchArgs(tokens, 'env'); } catch (e) { if (String(e).includes('missing value for')) reportEnvVarIssue(e); else throw e; }

Prevention

When it happens

Trigger: Args ending in -c/--config, or the flag followed by another flag, or an empty --config= assignment.

Common situations: Env var or inherited args built by string concatenation where the config path variable is empty; mixing short and long config flags incorrectly.

Related errors


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