{"record":{"id":"7c78c3e847bed1ec","repo":"coleam00/Archon","slug":"not-in-a-git-repository-run-archon-workflow-insta","errorCode":null,"errorMessage":"Not in a git repository. Run archon workflow install from within a git repo.","messagePattern":"Not in a git repository\\. Run archon workflow install from within a git repo\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":5163,"sourceCode":"    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>\"`);\n}\n\nasync function installSingleFile(\n  entry: MarketplaceEntryJson,\n  slug: string,\n  archonDir: string,","sourceCodeStart":5145,"sourceCodeEnd":5181,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L5145-L5181","documentation":"The install command requires a git repository because workflows are installed into `<repoRoot>/.archon/workflows/`. If `findRepoRoot(cwd)` (from `@archon/git`) returns null — cwd is outside any git worktree — the command aborts with this guidance.","triggerScenarios":"Running `archon workflow install <slug>` from a directory that is not inside a git repository (including being in `$HOME`, `/tmp`, or a plain folder), or in a directory whose `.git` is broken/unreadable.","commonSituations":"Running the CLI from the home directory or a scratch folder; repo root detection failing due to a corrupted `.git`; working in a bare repo or worktree layout the detection does not recognize; wrong directory in a multi-repo setup.","solutions":["`cd` into your project's git repository and re-run the install command","Run `git rev-parse --show-toplevel` to confirm you are inside a repo","If `.git` is broken, repair it (re-clone or fix the worktree)","Create the repo if the project is not yet under git: `git init`"],"exampleFix":"// before\ncd /tmp && archon workflow install code-review\n// after\ncd ~/projects/my-app && archon workflow install code-review","handlingStrategy":"validation","validationCode":"import { execSync } from 'node:child_process';\nconst root = execSync('git rev-parse --show-toplevel', { cwd: process.cwd(), stdio: ['ignore','pipe','ignore'] }).toString().trim();\nconsole.log(`Installing into ${root}/.archon/workflows`);","typeGuard":"function isInsideGitRepo(cwd: string): boolean {\n  try {\n    execSync('git rev-parse --is-inside-work-tree', { cwd, stdio: 'ignore' });\n    return true;\n  } catch { return false; }\n}","tryCatchPattern":"try {\n  await workflowInstallCommand(slug);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('Not in a git repository')) {\n    // cd to repo root or git init, then retry\n  } else throw e;\n}","preventionTips":["Run the CLI from inside your project repo (check `git rev-parse --show-toplevel` first)","`git init` projects that are not yet under version control","In CI, ensure the checkout step ran before install commands","Repair corrupted `.git` directories promptly"],"tags":["git","cli","environment","working-directory"],"backgroundTag":"not-a-git-repository","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}