{"record":{"id":"9623a7a47d5709e1","repo":"Yeachan-Heo/oh-my-codex","slug":"invalid-team-name-rawteamname-must-match","errorCode":null,"errorMessage":"Invalid team_name: \"${rawTeamName}\". Must match /^[a-z0-9][a-z0-9-]{0,29}$/ or resolve to an existing display name.","messagePattern":"Invalid team_name: \"(.+?)\"\\. Must match /\\^\\[a-z0-9\\]\\[a-z0-9-\\](.+?)\\$/ or resolve to an existing display name\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/api-interop.ts","lineNumber":604,"sourceCode":"function 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(/-$/, '');\n}\n\nfunction assertUnsafeTeamNameMatchesKnownDisplay(rawTeamName: string, cwd: string): void {\n  if (TEAM_NAME_SAFE_PATTERN.test(rawTeamName)) return;\n  const normalized = normalizeTeamDisplayLookupName(rawTeamName);\n  const matchesKnownDisplay = listTeamLookupCandidates(cwd).some((candidate) => {\n    return normalizeTeamDisplayLookupName(candidate.displayName) === normalized\n      || normalizeTeamDisplayLookupName(candidate.requestedName) === normalized;\n  });\n  if (!matchesKnownDisplay) {\n    throw new Error(`Invalid team_name: \"${rawTeamName}\". Must match /^[a-z0-9][a-z0-9-]{0,29}$/ or resolve to an existing display name.`);\n  }\n}\n\nexport async function executeTeamApiOperation(\n  operation: TeamApiOperation,\n  args: Record<string, unknown>,\n  fallbackCwd: string,\n): Promise<TeamApiEnvelope> {\n  try {\n    validateCommonFields(args, { skipTeamName: true });\n    const rawTeamNameForCwd = String(args.team_name || '').trim();\n    if (rawTeamNameForCwd) assertUnsafeTeamNameMatchesKnownDisplay(rawTeamNameForCwd, fallbackCwd);\n    const resolvedTeamName = rawTeamNameForCwd ? resolveTeamNameForCurrentContext(rawTeamNameForCwd, fallbackCwd) : '';\n    const cwd = resolvedTeamName ? resolveTeamWorkingDirectory(resolvedTeamName, fallbackCwd) : fallbackCwd;\n    const opArgs = resolvedTeamName ? { ...args, team_name: resolvedTeamName } : args;\n    validateCommonFields(opArgs);\n\n    switch (operation) {","sourceCodeStart":586,"sourceCodeEnd":622,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/api-interop.ts#L586-L622","documentation":"Thrown during display-name resolution: the team_name neither matches the strict safe pattern nor resolves to any known display/requested name in the current workspace (via listTeamLookupCandidates). It means the team is unknown to this repository's state.","triggerScenarios":"Passing a human-readable team name that was never registered/persisted in the workspace, or a typo, or running from the wrong cwd where the team candidates are not listed.","commonSituations":"Running the API from a different working directory than where the team was created; stale workspace state after cleanup; typo in display name casing/punctuation.","solutions":["Run from the repository root where the team state exists","List available team lookup candidates to find the exact accepted name","Fall back to the team's canonical slug matching the safe pattern"],"exampleFix":"// before\napi('status', { team_name: 'My Team' }); // unknown in this cwd\n// after\nconst cands = listTeamLookupCandidates(cwd); // pick exact displayName\napi('status', { team_name: cands[0].displayName });","handlingStrategy":"fallback","validationCode":"const known = listTeamLookupCandidates(cwd);\nconst ok = /^[a-z0-9][a-z0-9-]{0,29}$/.test(name)\n  || known.some((c) => c.displayName === name || c.requestedName === name);\nif (!ok) throw new Error('unknown team name');","typeGuard":null,"tryCatchPattern":"catch (e) { if (/or resolve to an existing display name/.test(e.message)) { const cands = listTeamLookupCandidates(cwd); /* pick or create team */ } }","preventionTips":["Always run team operations from the repo root holding team state","Cache the canonical team slug at creation time and reuse it"],"tags":["team-name","resolution","workspace-state"],"backgroundTag":"entity-not-found","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}