{"record":{"id":"b5cb306a56b2293a","repo":"Yeachan-Heo/oh-my-codex","slug":"worker-toworker-not-found-in-team","errorCode":null,"errorMessage":"Worker ${toWorker} not found in team","messagePattern":"Worker (.+?) not found in team","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/runtime.ts","lineNumber":6950,"sourceCode":"    config,\n    dispatchPolicy,\n    cwd,\n    fallbackNotify: async () => await notifyLeaderAsync(config, triggerDirective.text, cwd),\n  });\n}\n\nasync function sendRecipientMailboxMessage(params: {\n  teamName: string;\n  fromWorker: string;\n  toWorker: string;\n  body: string;\n  config: TeamConfig;\n  dispatchPolicy: TeamPolicy;\n  cwd: string;\n}): Promise<DispatchOutcome> {\n  const { teamName, fromWorker, toWorker, body, config, dispatchPolicy, cwd } = params;\n  const recipient = config.workers.find((worker) => worker.name === toWorker);\n  if (!recipient) throw new Error(`Worker ${toWorker} not found in team`);\n\n  const triggerDirective = buildMailboxTriggerDirective(\n    toWorker,\n    teamName,\n    1,\n    resolveInstructionStateRoot(recipient.worktree_path),\n  );\n  const transportPreference = resolveWorkerMailboxTransportPreference(config, dispatchPolicy);\n  const queuedOutcome = await queueDirectMailboxMessage({\n    teamName,\n    fromWorker,\n    toWorker,\n    toWorkerIndex: recipient.index,\n    toPaneId: recipient.pane_id,\n    body,\n    triggerMessage: triggerDirective.text,\n    intent: triggerDirective.intent,\n    cwd,","sourceCodeStart":6932,"sourceCodeEnd":6968,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/runtime.ts#L6932-L6968","documentation":"Thrown when dispatching a worker-to-worker message: the recipient name toWorker does not match any worker in the team config.","triggerScenarios":"Calling the dispatch/send API with a toWorker name not present in config.workers (typo, renamed worker, or scaled-down worker).","commonSituations":"Hardcoding worker names after a team is recreated with different names, or referencing a worker removed by scaleDown.","solutions":["List the team's workers from its config and use an exact name","If the worker was removed by scaling, re-dispatch to an existing worker or scale up first","Avoid assuming worker names; resolve them dynamically"],"exampleFix":"// before\ndispatch({ teamName, fromWorker: 'w1', toWorker: 'workr-2', body, ... });\n// after\nconst config = await readTeamConfig(teamName, cwd);\nconst toWorker = config.workers.find(w => w.name.startsWith('workr'))!.name;","handlingStrategy":"type-guard","validationCode":"const cfg = await readTeamConfig(teamName, cwd); if (!cfg.workers.some(w => w.name === toWorker)) throw new Error(`unknown worker ${toWorker}`);","typeGuard":"const workerExists = (cfg: TeamConfig, name: string) => cfg.workers.some(w => w.name === name);","tryCatchPattern":null,"preventionTips":["Resolve worker names from config at runtime instead of hardcoding","Handle not-found before dispatch with a clear user error"],"tags":["team","dispatch","worker-not-found"],"backgroundTag":"invalid-recipient","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}