{"record":{"id":"40344e85b6c83d59","repo":"coleam00/Archon","slug":"multiple-packaged-workflows-declare-the-name-na","errorCode":null,"errorMessage":"Multiple packaged workflows declare the name '${name}'","messagePattern":"Multiple packaged workflows declare the name '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/server/src/routes/api.ts","lineNumber":208,"sourceCode":"        .sort((a, b) => a.localeCompare(b));\n      if (yamlFiles.length !== 1) continue;\n\n      const yamlFilename = yamlFiles[0];\n      const absolutePath = join(workflowPath, yamlFilename);\n      let content: string;\n      try {\n        content = await readFile(absolutePath, 'utf-8');\n      } catch (error) {\n        if ((error as NodeJS.ErrnoException).code === 'ENOENT') continue;\n        throw error;\n      }\n      const parsed = parseWorkflow(content, yamlFilename);\n      const yamlStem = yamlFilename.replace(/\\.ya?ml$/, '');\n      const isMalformedTarget =\n        parsed.workflow === null && (yamlStem === name || workflowFolder === name);\n      if (parsed.workflow?.name !== name && !isMalformedTarget) continue;\n      if (match !== null) {\n        throw new Error(`Multiple packaged workflows declare the name '${name}'`);\n      }\n      match = {\n        absolutePath,\n        filename: `${pack}/${workflowFolder}/${yamlFilename}`,\n        packaged: true,\n        parsed,\n      };\n    }\n  }\n  return match;\n}\n\nasync function findWorkflowAt(\n  workflowsRoot: string,\n  name: string\n): Promise<RawWorkflowFile | null> {\n  return (\n    (await tryReadWorkflowAt(workflowsRoot, name)) ??","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/server/src/routes/api.ts#L190-L226","documentation":"findPackagedWorkflowAt resolves a workflow name to exactly one file under the packaged-workflow directories. If two different files in the scanned packs (folder name, YAML stem, or frontmatter `name`) both resolve to the requested name, the function throws rather than returning an ambiguous match. This protects run creation from silently launching the wrong workflow.","triggerScenarios":"GET/lookup by workflow name via findWorkflowAt/hit/packaged, where two files across packs both match: same frontmatter `name:` in different packs, or a folder/stem collision with a malformed YAML file (isMalformedTarget) that also matches the name.","commonSituations":"Forking a bundled/packaged workflow and leaving the original `name:` in frontmatter while renaming only the file; two workflow packs installed side by side each containing a workflow with the same name; a broken YAML file whose stem equals a valid workflow's name, counted as a second match.","solutions":["Find the duplicate: grep the workflow packs for `name: '<the name>'` in the frontmatter and rename one workflow's `name:` to a unique value.","If a malformed YAML file is the second match, fix its syntax or remove/rename it so it no longer collides.","Remove an obsolete copy of the workflow left behind after a fork or pack update.","Reference the workflow by its file path/id instead of name if supported, until the duplicate is resolved."],"exampleFix":"# before: two packs both contain\nname: fix-issue\n# after: rename one\nname: fix-issue-v2","handlingStrategy":"validation","validationCode":"const names = new Set<string>();\nfor (const f of workflowFiles) {\n  const name = parseWorkflow(readFileSync(f, 'utf8'), f).workflow?.name;\n  if (name && names.has(name)) throw new Error(`Duplicate packaged workflow name: ${name} (${f})`);\n  if (name) names.add(name);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const wf = await getWorkflowByName(name);\n} catch (e) {\n  if (/Multiple packaged workflows declare the name/i.test(e?.message ?? '')) {\n    logError(`Ambiguous workflow name '${name}'; rename one copy in the packs.`);\n  } else throw e;\n}","preventionTips":["When forking a packaged workflow, always change the frontmatter `name:` too.","Run a duplicate-name lint over workflow packs before installing.","Fix or remove malformed YAML files — their stems count as name matches.","Reference workflows by path in automation to avoid name ambiguity."],"tags":["workflows","duplicate-name","packaged-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"}