{"record":{"id":"150e7ad3bebef030","repo":"coleam00/Archon","slug":"multiple-bundled-workflows-declare-the-name-nam","errorCode":null,"errorMessage":"Multiple bundled workflows declare the name '${name}'","messagePattern":"Multiple bundled workflows declare the name '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/server/src/routes/api.ts","lineNumber":256,"sourceCode":"  const direct = BUNDLED_WORKFLOWS[name];\n  if (direct !== undefined) {\n    const filename = `${name}.yaml`;\n    const parsed = parseWorkflow(direct, filename);\n    if (parsed.error !== null || parsed.workflow?.name === name) {\n      return { filename, parsed };\n    }\n  }\n\n  let match: {\n    filename: string;\n    parsed: ReturnType<typeof parseWorkflow>;\n  } | null = null;\n  for (const [filenameStem, content] of Object.entries(BUNDLED_WORKFLOWS)) {\n    if (filenameStem === name) continue;\n    const filename = `${filenameStem}.yaml`;\n    const parsed = parseWorkflow(content, filename);\n    if (parsed.workflow?.name !== name) continue;\n    if (match !== null) throw new Error(`Multiple bundled workflows declare the name '${name}'`);\n    match = { filename, parsed };\n  }\n  return match;\n}\nimport * as conversationDb from '@archon/core/db/conversations';\nimport * as codebaseDb from '@archon/core/db/codebases';\nimport * as envVarDb from '@archon/core/db/env-vars';\nimport * as isolationEnvDb from '@archon/core/db/isolation-environments';\nimport * as workflowDb from '@archon/core/db/workflows';\nimport * as workflowEventDb from '@archon/core/db/workflow-events';\nimport * as messageDb from '@archon/core/db/messages';\nimport * as userDb from '@archon/core/db/users';\nimport {\n  abandonWorkflow,\n  approveWorkflow,\n  rejectWorkflow,\n  respondToWorkflow,\n  assertRespondable,","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/server/src/routes/api.ts#L238-L274","documentation":"findBundledWorkflow resolves a name against BUNDLED_WORKFLOWS, the in-memory registry of workflows shipped inside the server bundle. It matches either the filename stem or the frontmatter `name:`; if two bundled files both match the requested name it throws instead of picking arbitrarily, keeping resolution deterministic and ambiguity loud.","triggerScenarios":"Calling the /bundled workflow lookup (bundled handler or registerApiRoutes) with a name that two entries in BUNDLED_WORKFLOWS both satisfy — identical frontmatter names, or a stem/frontmatter collision across two generated files.","commonSituations":"A release/build bug where the bundled-workflow generation script emitted two files with the same frontmatter `name:`; locally added a test workflow to the bundle with a name that clashes with a shipped one; a stale generated artifact duplicating a workflow under a new filename.","solutions":["Inspect the BUNDLED_WORKFLOWS generation (owning script in package.json) and give each workflow a unique frontmatter `name:`.","Regenerate the bundled workflow artifact with its owning script so duplicates from stale builds disappear.","If a locally added workflow collided with a shipped name, rename yours.","As a workaround, look the workflow up by its filename stem rather than frontmatter name if that resolves uniquely."],"exampleFix":"// before: two bundled entries\n// fix-issue.yaml -> name: fix-issue\n// fix-issue-2.yaml -> name: fix-issue\n// after\n// fix-issue-2.yaml -> name: fix-issue-v2","handlingStrategy":"validation","validationCode":"const seen = new Map<string, string>();\nfor (const [stem, content] of Object.entries(BUNDLED_WORKFLOWS)) {\n  const name = parseWorkflow(content, `${stem}.yaml`).workflow?.name;\n  if (name && seen.has(name)) throw new Error(`Duplicate bundled name '${name}': ${seen.get(name)} vs ${stem}`);\n  if (name) seen.set(name, stem);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const wf = findBundledWorkflow(name);\n} catch (e) {\n  if (/Multiple bundled workflows declare the name/i.test(e?.message ?? '')) {\n    logError(`Ambiguous bundled workflow '${name}'; regenerate the bundle with unique names.`);\n  } else throw e;\n}","preventionTips":["Add a uniqueness assertion to the bundled-workflow generation script.","Regenerate bundle artifacts via their owning script after editing workflows.","Never hand-edit generated bundled files; rename at the source.","Cover name uniqueness with a unit test over BUNDLED_WORKFLOWS."],"tags":["workflows","duplicate-name","bundled-workflows","resolution"],"backgroundTag":"duplicate-workflow-name","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}