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

Worker ${toWorker} not found in team

Error message

Worker ${toWorker} not found in team

What it means

Thrown when dispatching a worker-to-worker message: the recipient name toWorker does not match any worker in the team config.

Source

Thrown at src/team/runtime.ts:6950

    config,
    dispatchPolicy,
    cwd,
    fallbackNotify: async () => await notifyLeaderAsync(config, triggerDirective.text, cwd),
  });
}

async function sendRecipientMailboxMessage(params: {
  teamName: string;
  fromWorker: string;
  toWorker: string;
  body: string;
  config: TeamConfig;
  dispatchPolicy: TeamPolicy;
  cwd: string;
}): Promise<DispatchOutcome> {
  const { teamName, fromWorker, toWorker, body, config, dispatchPolicy, cwd } = params;
  const recipient = config.workers.find((worker) => worker.name === toWorker);
  if (!recipient) throw new Error(`Worker ${toWorker} not found in team`);

  const triggerDirective = buildMailboxTriggerDirective(
    toWorker,
    teamName,
    1,
    resolveInstructionStateRoot(recipient.worktree_path),
  );
  const transportPreference = resolveWorkerMailboxTransportPreference(config, dispatchPolicy);
  const queuedOutcome = await queueDirectMailboxMessage({
    teamName,
    fromWorker,
    toWorker,
    toWorkerIndex: recipient.index,
    toPaneId: recipient.pane_id,
    body,
    triggerMessage: triggerDirective.text,
    intent: triggerDirective.intent,
    cwd,

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. List the team's workers from its config and use an exact name
  2. If the worker was removed by scaling, re-dispatch to an existing worker or scale up first
  3. Avoid assuming worker names; resolve them dynamically

Example fix

// before
dispatch({ teamName, fromWorker: 'w1', toWorker: 'workr-2', body, ... });
// after
const config = await readTeamConfig(teamName, cwd);
const toWorker = config.workers.find(w => w.name.startsWith('workr'))!.name;
Defensive patterns

Strategy: type-guard

Validate before calling

const cfg = await readTeamConfig(teamName, cwd); if (!cfg.workers.some(w => w.name === toWorker)) throw new Error(`unknown worker ${toWorker}`);

Type guard

const workerExists = (cfg: TeamConfig, name: string) => cfg.workers.some(w => w.name === name);

Prevention

When it happens

Trigger: Calling the dispatch/send API with a toWorker name not present in config.workers (typo, renamed worker, or scaled-down worker).

Common situations: Hardcoding worker names after a team is recreated with different names, or referencing a worker removed by scaleDown.

Related errors


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