coleam00/Archon · error

Not in a git repository. Run archon workflow install from wi

Error message

Not in a git repository. Run archon workflow install from within a git repo.

What it means

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.

Source

Thrown at packages/cli/src/commands/workflow.ts:5163

    console.error(`Error: Workflow '${slug}' not found in marketplace.`);
    console.error("Run 'archon workflow search' to browse available workflows.");
    throw new Error(`Workflow '${slug}' not found`);
  }

  if (!entry.sourceUrl.startsWith('https://github.com/')) {
    throw new Error(
      `Untrusted source URL for '${slug}': ${entry.sourceUrl}\nOnly github.com sources are permitted.`
    );
  }

  if (!/^[a-z0-9-]+$/.test(slug)) {
    throw new Error(`Invalid slug '${slug}': must be lowercase alphanumeric with hyphens only.`);
  }

  const { findRepoRoot } = await import('@archon/git');
  const repoRoot = await findRepoRoot(cwd);
  if (!repoRoot) {
    throw new Error('Not in a git repository. Run archon workflow install from within a git repo.');
  }

  const { existsSync, mkdirSync, writeFileSync } = await import('node:fs');
  const archonDir = join(repoRoot, '.archon');

  if (isDirectoryUrl(entry.sourceUrl)) {
    await installDirectory(entry, slug, archonDir, force, existsSync, mkdirSync, writeFileSync);
  } else {
    await installSingleFile(entry, slug, archonDir, force, existsSync, mkdirSync, writeFileSync);
  }

  console.log(`Run with: archon workflow run ${slug} "<message>"`);
}

async function installSingleFile(
  entry: MarketplaceEntryJson,
  slug: string,
  archonDir: string,

View on GitHub (pinned to 0773b97458)

Solutions

  1. `cd` into your project's git repository and re-run the install command
  2. Run `git rev-parse --show-toplevel` to confirm you are inside a repo
  3. If `.git` is broken, repair it (re-clone or fix the worktree)
  4. Create the repo if the project is not yet under git: `git init`

Example fix

// before
cd /tmp && archon workflow install code-review
// after
cd ~/projects/my-app && archon workflow install code-review
Defensive patterns

Strategy: validation

Validate before calling

import { execSync } from 'node:child_process';
const root = execSync('git rev-parse --show-toplevel', { cwd: process.cwd(), stdio: ['ignore','pipe','ignore'] }).toString().trim();
console.log(`Installing into ${root}/.archon/workflows`);

Type guard

function isInsideGitRepo(cwd: string): boolean {
  try {
    execSync('git rev-parse --is-inside-work-tree', { cwd, stdio: 'ignore' });
    return true;
  } catch { return false; }
}

Try / catch

try {
  await workflowInstallCommand(slug);
} catch (e) {
  if (e instanceof Error && e.message.includes('Not in a git repository')) {
    // cd to repo root or git init, then retry
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/7c78c3e847bed1ec. Report an issue: GitHub.