{"record":{"id":"bae9a9d65ced6c73","repo":"coleam00/Archon","slug":"cannot-resume-not-in-a-git-repository-either-run","errorCode":null,"errorMessage":"Cannot resume: Not in a git repository.\nEither run from a git repo or use /clone first.","messagePattern":"Cannot resume: Not in a git repository\\.\nEither run from a git repo or use /clone first\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":2371,"sourceCode":"    }\n  }\n\n  // Handle --resume: locate the prior failed run, reuse its worktree, and hand\n  // the resumed-run handle to executeWorkflow below via opts. The executor no\n  // longer performs implicit resume detection on its own.\n  let resumable: WorkflowRun | null = null;\n  if (options.resume) {\n    if (!codebase) {\n      if (codebaseLookupError) {\n        throw new Error(\n          'Cannot resume: Database lookup failed.\\n' +\n            `Error: ${codebaseLookupError.message}\\n` +\n            'Hint: Check your database connection before using --resume.'\n        );\n      }\n      if (codebaseRegistrationError) {\n        throw buildRegistrationFailureError('resume', codebaseRegistrationError);\n      }\n      throw new Error(\n        'Cannot resume: Not in a git repository.\\n' +\n          'Either run from a git repo or use /clone first.'\n      );\n    }\n\n    if (resumeLookupError) {\n      throw buildResumeLookupFailureError(resumeLookupError);\n    }\n    // Resolved before discovery (top of this function), because the graph this run\n    // executes had to be chosen from it.\n    resumable = continuationRun ?? null;\n\n    if (!resumable) {\n      throw buildNoResumableRunError(workflowName, cwd);\n    }\n\n    getLog().info(","sourceCodeStart":2353,"sourceCodeEnd":2389,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L2353-L2389","documentation":"Fallback guard in the --resume path: resume requires a resolved codebase, and if there is neither a lookup error (DB reachable) nor a registration error, the only remaining cause is that the cwd is not a git repository / not a recognized project. The CLI refuses to resume because the prior run's project cannot be matched to the current directory, and suggests cloning or running from a git repo.","triggerScenarios":"Running `archon workflow run <flow> --resume` from a plain directory with no .git, or from an unregistered non-git folder, so resolveRunCodebase returns no codebase and no error.","commonSituations":"Opening a terminal in a temp or extracted folder instead of the repo; the .git directory was deleted or the repo was moved; trying to resume a run from a completely different machine directory.","solutions":["cd into the actual git repository checkout for the project and retry --resume.","If the checkout is gone, re-clone it (the message suggests /clone) or start a fresh run with --branch.","Initialize git in the directory if it truly should be a repo (git init plus remote setup), then re-register."],"exampleFix":"// before\ncd /tmp/scratch && archon workflow run my-flow --resume  # Not in a git repository\n// after\ncd ~/work/my-project && archon workflow run my-flow --resume","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nif (!existsSync(join(process.cwd(), '.git'))) {\n  throw new Error(`cwd ${process.cwd()} is not a git repository; cd into the project checkout before --resume.`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runWorkflow({ resume: true });\n} catch (error) {\n  if ((error as Error).message.includes('Not in a git repository')) {\n    console.error('cd into the repo checkout (or clone it) and retry --resume.');\n  } else throw error;\n}","preventionTips":["Run resume commands from the repo root of the project.","Never delete .git when cleaning a checkout.","Clone the repo before attempting to resume runs from another machine."],"tags":["git","resume","cli","project-resolution"],"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"}