Yeachan-Heo/oh-my-codex · error · Error

Dynamic scaling is disabled. Set ${OMX_TEAM_SCALING_ENABLED_

Error message

Dynamic scaling is disabled. Set ${OMX_TEAM_SCALING_ENABLED_ENV}=1 to enable.

What it means

Thrown by assertScalingEnabled as a guard on all dynamic scaling APIs: scaling is feature-flagged off unless OMX_TEAM_SCALING_ENABLED=1 in the environment.

Source

Thrown at src/team/scaling.ts:278

    '-c', workerCwd, command,
  ].map(quoteTmuxCommand).join(' ');
  const result = spawnSync('tmux', [
    'if-shell', '-F', '-t', source.paneId, buildScalePaneAuthorityCondition(source), splitCommand, "display-message -p ''",
  ], { encoding: 'utf-8' });
  if (result.status !== 0) return null;
  const fields = (result.stdout || '').replace(/\r?\n$/, '').split('\t');
  if (fields.length !== 6 || fields[5] !== receipt) return null;
  const [paneId, pidText, sessionName, sessionId, windowId] = fields;
  const pid = Number(pidText);
  if (!/^%[0-9]+$/.test(paneId) || !Number.isSafeInteger(pid) || pid <= 0
    || !sessionName || !sessionId || !/^\$[0-9]+$/.test(sessionId) || !/^@[0-9]+$/.test(windowId)) return null;
  return { paneId, pid, sessionName, sessionId, windowId };
}


function assertScalingEnabled(env: NodeJS.ProcessEnv = process.env): void {
  if (!isScalingEnabled(env)) {
    throw new Error(
      `Dynamic scaling is disabled. Set ${OMX_TEAM_SCALING_ENABLED_ENV}=1 to enable.`,
    );
  }
}

function joinContextSections(...sections: Array<string | undefined>): string | undefined {
  const present = sections.filter((section): section is string => Boolean(section?.trim()));
  return present.length > 0 ? present.join('\n\n') : undefined;
}

// ── Result types ──────────────────────────────────────────────────────────────

export interface ScaleUpResult {
  ok: true;
  addedWorkers: WorkerInfo[];
  newWorkerCount: number;
  nextWorkerIndex: number;
}

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Set OMX_TEAM_SCALING_ENABLED=1 in the environment before calling scaleUp/scaleDown
  2. Pass the env explicitly if the API accepts it
  3. For libraries, default the flag off in prod and only enable where scaling is intended

Example fix

// before
await scaleDown({ ... });
// after
process.env.OMX_TEAM_SCALING_ENABLED = '1';
await scaleDown({ ... });
Defensive patterns

Strategy: validation

Validate before calling

if (process.env.OMX_TEAM_SCALING_ENABLED !== '1') throw new Error('enable OMX_TEAM_SCALING_ENABLED=1 first');

Type guard

const isScalingEnabled = (env = process.env) => env.OMX_TEAM_SCALING_ENABLED === '1';

Prevention

When it happens

Trigger: Calling scaleUp or scaleDown without OMX_TEAM_SCALING_ENABLED=1 set in process.env (or the value is not '1').

Common situations: Using the scaling API in a new environment/CI without exporting the flag, or after an upgrade that introduced the feature flag.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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