{"record":{"id":"fd59d0bbd695f0e3","repo":"Yeachan-Heo/oh-my-codex","slug":"invalid-worker-count-match-1-expected-min","errorCode":null,"errorMessage":"Invalid worker count \"${match[1]}\". Expected ${MIN_WORKER_COUNT}-${DEFAULT_MAX_WORKERS}.","messagePattern":"Invalid worker count \"(.+?)\"\\. Expected (.+?)-(.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/team.ts","lineNumber":859,"sourceCode":"}\n\nexport function parseTeamArgs(args: string[], cwd: string = process.cwd()): ParsedTeamArgs {\n  const tokens = [...args];\n  let workerCount = 3;\n  let agentType = 'executor';\n  let explicitAgentType = false;\n  let explicitWorkerCount = false;\n\n  if (tokens[0]?.toLowerCase() === 'ralph') {\n    throw new Error('Deprecated usage: `omx team ralph ...` has been removed. Use `omx team ...` or run `omx ralph ...` separately.');\n  }\n\n  const first = tokens[0] || '';\n  const match = first.match(/^(\\d+)(?::([a-z][a-z0-9-]*))?$/i);\n  if (match) {\n    const count = Number.parseInt(match[1], 10);\n    if (!Number.isFinite(count) || count < MIN_WORKER_COUNT || count > DEFAULT_MAX_WORKERS) {\n      throw new Error(`Invalid worker count \"${match[1]}\". Expected ${MIN_WORKER_COUNT}-${DEFAULT_MAX_WORKERS}.`);\n    }\n    workerCount = count;\n    explicitWorkerCount = true;\n    if (match[2]) {\n      agentType = match[2];\n      explicitAgentType = true;\n    }\n    tokens.shift();\n  }\n\n  const task = tokens.join(' ').trim();\n  if (!task) {\n    throw new Error('Usage: omx team [N:agent-type] \"<task description>\"');\n  }\n\n  const followupContext = resolveApprovedTeamFollowupContext(cwd, task);\n  const effectiveTask = followupContext?.task ?? task;\n  if (followupContext) {","sourceCodeStart":841,"sourceCodeEnd":877,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/team.ts#L841-L877","documentation":"Thrown when the first token matches the `<count>[:<agentType>]` pattern but the numeric count is outside MIN_WORKER_COUNT..DEFAULT_MAX_WORKERS (or not finite). The first token doubles as the worker-count specifier, so its count portion is range-validated before use.","triggerScenarios":"`omx team 0 task`, `omx team 999 task`, or `omx team 99:executor task` when 99 exceeds DEFAULT_MAX_WORKERS.","commonSituations":"Assuming any worker count is allowed on bigger machines, porting configs from versions with a different max, or a leading number that was meant as part of the task text.","solutions":["Use a count within MIN_WORKER_COUNT..DEFAULT_MAX_WORKERS as shown in the message (default is 3).","If you didn't intend to set workers, remove the leading `N:` token — without it the default count applies.","Omit the count entirely to accept the default: `omx team \"do the thing\"`."],"exampleFix":"# before\nomx team 500:executor \"run suite\"\n# after\nomx team 8:executor \"run suite\"   # within MIN_WORKER_COUNT..DEFAULT_MAX_WORKERS","handlingStrategy":"validation","validationCode":"const m = (tokens[0] || '').match(/^(\\d+)(?::([a-z][a-z0-9-]*))?$/i);\nif (m) {\n  const n = Number.parseInt(m[1], 10);\n  if (!(n >= MIN_WORKER_COUNT && n <= DEFAULT_MAX_WORKERS)) {\n    console.error(`Worker count must be ${MIN_WORKER_COUNT}-${DEFAULT_MAX_WORKERS}`); process.exit(2);\n  }\n}","typeGuard":"function isValidWorkerToken(t: string): boolean {\n  const m = t.match(/^(\\d+)(?::[a-z][a-z0-9-]*)?$/i);\n  if (!m) return true; // not a worker token\n  const n = Number.parseInt(m[1], 10);\n  return n >= MIN_WORKER_COUNT && n <= DEFAULT_MAX_WORKERS;\n}","tryCatchPattern":"try { await teamCommand(tokens); } catch (e) {\n  if (e instanceof Error && e.message.startsWith('Invalid worker count')) { /* drop leading count token to use default and retry */ }\n  else throw e;\n}","preventionTips":["Omit the leading N: token unless you truly need a custom worker count.","Read MIN_WORKER_COUNT/DEFAULT_MAX_WORKERS from the installed version before scripting counts."],"tags":["cli","range-check","argument-validation"],"backgroundTag":"cli-argument-out-of-range","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}