{"record":{"id":"48bff5231cac235b","repo":"Yeachan-Heo/oh-my-codex","slug":"invalid-workerfield-workerval-must-match","errorCode":null,"errorMessage":"Invalid ${workerField}: \"${workerVal}\". Must match /^[a-z0-9][a-z0-9-]{0,63}$/ (lowercase alphanumeric + hyphens, max 64 chars).","messagePattern":"Invalid (.+?): \"(.+?)\"\\. Must match /\\^\\[a-z0-9\\]\\[a-z0-9-\\](.+?)\\$/ \\(lowercase alphanumeric \\+ hyphens, max 64 chars\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/api-interop.ts","lineNumber":575,"sourceCode":"export function buildLegacyTeamDeprecationHint(legacyName: string, originalArgs?: Record<string, unknown>): string {\n  const operation = resolveTeamApiOperation(legacyName);\n  const payload = JSON.stringify(originalArgs ?? {});\n  if (!operation) {\n    return `Use CLI interop: omx team api <operation> --input '${payload}' --json`;\n  }\n  return `Use CLI interop: omx team api ${operation} --input '${payload}' --json`;\n}\n\nfunction validateCommonFields(args: Record<string, unknown>, options: { skipTeamName?: boolean } = {}): void {\n  const teamName = String(args.team_name || '').trim();\n  if (!options.skipTeamName && teamName && !TEAM_NAME_SAFE_PATTERN.test(teamName)) {\n    throw new Error(`Invalid team_name: \"${teamName}\". Must match /^[a-z0-9][a-z0-9-]{0,29}$/ (lowercase alphanumeric + hyphens, max 30 chars).`);\n  }\n\n  for (const workerField of ['worker', 'from_worker', 'to_worker']) {\n    const workerVal = String(args[workerField] || '').trim();\n    if (workerVal && !WORKER_NAME_SAFE_PATTERN.test(workerVal)) {\n      throw new Error(`Invalid ${workerField}: \"${workerVal}\". Must match /^[a-z0-9][a-z0-9-]{0,63}$/ (lowercase alphanumeric + hyphens, max 64 chars).`);\n    }\n  }\n\n  const rawTaskId = String(args.task_id || '').trim();\n  if (rawTaskId && !TASK_ID_SAFE_PATTERN.test(rawTaskId)) {\n    throw new Error(`Invalid task_id: \"${rawTaskId}\". Must be a positive integer (digits only, max 20 digits).`);\n  }\n}\n\n\nfunction normalizeTeamDisplayLookupName(value: string): string {\n  return value\n    .toLowerCase()\n    .replace(/[^a-z0-9]+/g, '-')\n    .replace(/-+/g, '-')\n    .replace(/^-|-$/g, '')\n    .slice(0, 30)\n    .replace(/-$/, '');","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/api-interop.ts#L557-L593","documentation":"validateCommonFields throws this when worker, from_worker, or to_worker is non-empty and fails WORKER_NAME_SAFE_PATTERN (/^[a-z0-9][a-z0-9-]{0,63}$/). Worker names are constrained for safe CLI and path handling.","triggerScenarios":"Passing a worker field with uppercase, underscores, spaces, leading hyphen, or length over 64 characters to any team API operation.","commonSituations":"Worker names auto-generated from hostnames containing dots or underscores; renaming schemes that use CamelCase; copy-paste with trailing whitespace or newline.","solutions":["Normalize worker names to lowercase-alphanumeric-with-hyphens","Check length <= 64 and that the first char is a letter/digit","Regenerate worker names from the approved naming scheme rather than free-form input"],"exampleFix":"// before\napi('send-message', { from_worker: 'Worker_1' });\n// after\napi('send-message', { from_worker: 'worker-1' });","handlingStrategy":"validation","validationCode":"const WORKER = /^[a-z0-9][a-z0-9-]{0,63}$/;\nfor (const f of ['worker','from_worker','to_worker']) {\n  const v = String(args[f] || '').trim();\n  if (v && !WORKER.test(v)) throw new RangeError(`${f} format invalid`);\n}","typeGuard":"const isSafeWorkerName = (n: string): boolean => /^[a-z0-9][a-z0-9-]{0,63}$/.test(n);","tryCatchPattern":null,"preventionTips":["Generate worker names from a slugify helper, never free-form input","Reject hostnames with dots before deriving worker names"],"tags":["validation","worker-name","naming-rules"],"backgroundTag":"invalid-identifier-format","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}