{"record":{"id":"7212b7d3f471dd3c","repo":"coleam00/Archon","slug":"invalid-slug-slug-must-be-lowercase-alphanum","errorCode":null,"errorMessage":"Invalid slug '${slug}': must be lowercase alphanumeric with hyphens only.","messagePattern":"Invalid slug '(.+?)': must be lowercase alphanumeric with hyphens only\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":5157,"sourceCode":"  force?: boolean\n): Promise<void> {\n  const entries = await fetchMarketplace();\n  const entry = entries.find(e => e.slug === slug);\n\n  if (!entry) {\n    console.error(`Error: Workflow '${slug}' not found in marketplace.`);\n    console.error(\"Run 'archon workflow search' to browse available workflows.\");\n    throw new Error(`Workflow '${slug}' not found`);\n  }\n\n  if (!entry.sourceUrl.startsWith('https://github.com/')) {\n    throw new Error(\n      `Untrusted source URL for '${slug}': ${entry.sourceUrl}\\nOnly github.com sources are permitted.`\n    );\n  }\n\n  if (!/^[a-z0-9-]+$/.test(slug)) {\n    throw new Error(`Invalid slug '${slug}': must be lowercase alphanumeric with hyphens only.`);\n  }\n\n  const { findRepoRoot } = await import('@archon/git');\n  const repoRoot = await findRepoRoot(cwd);\n  if (!repoRoot) {\n    throw new Error('Not in a git repository. Run archon workflow install from within a git repo.');\n  }\n\n  const { existsSync, mkdirSync, writeFileSync } = await import('node:fs');\n  const archonDir = join(repoRoot, '.archon');\n\n  if (isDirectoryUrl(entry.sourceUrl)) {\n    await installDirectory(entry, slug, archonDir, force, existsSync, mkdirSync, writeFileSync);\n  } else {\n    await installSingleFile(entry, slug, archonDir, force, existsSync, mkdirSync, writeFileSync);\n  }\n\n  console.log(`Run with: archon workflow run ${slug} \"<message>\"`);","sourceCodeStart":5139,"sourceCodeEnd":5175,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L5139-L5175","documentation":"Slug format validation in `workflowInstallCommand`: the slug must match `/^[a-z0-9-]+$/` (lowercase letters, digits, hyphens only). Since the slug becomes the installed filename and is used in directory-membership checks, a strictly constrained format keeps it a safe path component.","triggerScenarios":"`archon workflow install '<slug>'` with an empty slug, uppercase letters, underscores, spaces, dots, slashes, or unicode characters. Only runs after the entry is found and its URL validated.","commonSituations":"Typing a display name like `PR Review` instead of a slug; copy-paste with trailing whitespace or newline; using `my_workflow` or `MyWorkflow`; shell quoting issues injecting spaces.","solutions":["Re-run with only lowercase letters, digits, and hyphens","Trim surrounding whitespace: `archon workflow install \"$(echo $slug | xargs)\"`","Copy the slug exactly from `archon workflow search` output","Check shell quoting — quote the argument to avoid word-splitting"],"exampleFix":"// before\narchon workflow install My_Workflow\n// after\narchon workflow install my-workflow","handlingStrategy":"validation","validationCode":"const slug = raw.trim();\nif (!/^[a-z0-9-]+$/.test(slug)) {\n  throw new Error(`'${slug}' must be lowercase alphanumeric with hyphens`);\n}","typeGuard":"function isValidSlug(s: string): boolean {\n  return /^[a-z0-9-]+$/.test(s);\n}","tryCatchPattern":"try {\n  await workflowInstallCommand(slug);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('Invalid slug')) {\n    // normalize (lowercase, spaces→hyphens) and retry once\n  } else throw e;\n}","preventionTips":["Normalize user input: `.trim().toLowerCase().replace(/\\s+/g, '-')` before passing slugs","Quote CLI arguments to avoid shell word-splitting","Validate slugs in scripts before invoking install","Copy exact slugs from search output"],"tags":["cli","validation","slug-format","input-validation"],"backgroundTag":"invalid-identifier-format","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}