{"record":{"id":"a791000c8db3bc09","repo":"Yeachan-Heo/oh-my-codex","slug":"invalid-team-name-teamname-must-match-a","errorCode":null,"errorMessage":"Invalid team_name: \"${teamName}\". Must match /^[a-z0-9][a-z0-9-]{0,29}$/ (lowercase alphanumeric + hyphens, max 30 chars).","messagePattern":"Invalid team_name: \"(.+?)\"\\. Must match /\\^\\[a-z0-9\\]\\[a-z0-9-\\](.+?)\\$/ \\(lowercase alphanumeric \\+ hyphens, max 30 chars\\)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/api-interop.ts","lineNumber":569,"sourceCode":"\nexport function resolveTeamApiOperation(name: string): TeamApiOperation | null {\n  const normalized = normalizeTeamName(name);\n  return TEAM_API_OPERATIONS.includes(normalized as TeamApiOperation) ? (normalized as TeamApiOperation) : null;\n}\n\nexport 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","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/api-interop.ts#L551-L587","documentation":"validateCommonFields throws this when a non-empty team_name fails TEAM_NAME_SAFE_PATTERN (/^[a-z0-9][a-z0-9-]{0,29}$/). Team names must be lowercase alphanumeric plus hyphens, start alphanumeric, max 30 chars — a safety constraint for filesystem and CLI usage.","triggerScenarios":"Calling executeTeamApiOperation with team_name containing uppercase letters, underscores, spaces, a leading hyphen, or exceeding 30 characters.","commonSituations":"Using a display name like 'My Team' as team_name; org names with underscores copied from CI config; hyphen-prefixed branch-derived names.","solutions":["Lowercase the name and replace unsupported characters with hyphens","Ensure the first character is a letter or digit (no leading hyphen)","Trim the name to 30 characters or use the team's registered slug"],"exampleFix":"// before\napi('status', { team_name: 'My_Team' });\n// after\napi('status', { team_name: 'my-team' });","handlingStrategy":"validation","validationCode":"const TEAM = /^[a-z0-9][a-z0-9-]{0,29}$/;\nconst name = String(args.team_name || '').trim();\nif (name && !TEAM.test(name)) throw new RangeError('team_name format invalid');","typeGuard":"const isSafeTeamName = (n: string): boolean => /^[a-z0-9][a-z0-9-]{0,29}$/.test(n);","tryCatchPattern":null,"preventionTips":["Centralize name sanitization in one helper used by all callers","Keep display names out of API args; resolve to slugs first"],"tags":["validation","team-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"}