{"record":{"id":"a7c967d6e5f0b9c5","repo":"Yeachan-Heo/oh-my-codex","slug":"catalog-manifest-invalid-duplicate-agent-name","errorCode":null,"errorMessage":"catalog_manifest_invalid:duplicate_agent:${name}","messagePattern":"catalog_manifest_invalid:duplicate_agent:(.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/catalog/schema.ts","lineNumber":106,"sourceCode":"    };\n  });\n\n  const seenAgents = new Set<string>();\n  const agents: CatalogAgentEntry[] = input.agents.map((entry, index) => {\n    if (!isObject(entry)) throw new Error(`catalog_manifest_invalid:agents[${index}]`);\n    assertNonEmptyString(entry.name, `agents[${index}].name`);\n    assertNonEmptyString(entry.category, `agents[${index}].category`);\n    assertNonEmptyString(entry.status, `agents[${index}].status`);\n\n    if (!AGENT_CATEGORIES.has(entry.category as CatalogAgentCategory)) {\n      throw new Error(`catalog_manifest_invalid:agents[${index}].category`);\n    }\n    if (!ENTRY_STATUSES.has(entry.status as CatalogEntryStatus)) {\n      throw new Error(`catalog_manifest_invalid:agents[${index}].status`);\n    }\n\n    const name = entry.name.trim();\n    if (seenAgents.has(name)) throw new Error(`catalog_manifest_invalid:duplicate_agent:${name}`);\n    seenAgents.add(name);\n\n    const canonical = typeof entry.canonical === 'string' && entry.canonical.trim() !== ''\n      ? entry.canonical.trim()\n      : undefined;\n\n    if ((entry.status === 'alias' || entry.status === 'merged') && !canonical) {\n      throw new Error(`catalog_manifest_invalid:agents[${index}].canonical`);\n    }\n\n    return {\n      name,\n      category: entry.category as CatalogAgentCategory,\n      status: entry.status as CatalogEntryStatus,\n      canonical,\n    };\n  });\n","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/catalog/schema.ts#L88-L124","documentation":"Agent names must be unique after trimming; when the same trimmed name appears twice in agents, the validator throws catalog_manifest_invalid:duplicate_agent:<name> with the duplicate name embedded. This prevents ambiguous agent resolution.","triggerScenarios":"Two agent entries with the same name (whitespace differences count as equal since comparison is on trimmed names).","commonSituations":"Concatenating manifests from multiple teams/sources, or duplicates introduced during category reorganization.","solutions":["Locate both entries with the name in the message and remove or rename one","Represent the extra as a distinct alias name with canonical pointing at the primary","Deduplicate the source data and regenerate"],"exampleFix":"// before\n\"agents\": [ {\"name\":\"builder\",...}, {\"name\":\"builder\",...} ]\n\n// after\n\"agents\": [ {\"name\":\"builder\",...}, {\"name\":\"build-agent\",\"status\":\"alias\",\"canonical\":\"builder\",\"category\":\"build\"} ]","handlingStrategy":"validation","validationCode":"const names = raw.agents.map((a: any) => String(a.name).trim());\nif (new Set(names).size !== names.length) { /* dedupe before validation */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Dedupe agent lists when merging manifests","Use alias entries with distinct names and canonical"],"tags":["catalog","manifest","duplicate","validation","agents"],"backgroundTag":"duplicate-entry","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}