{"record":{"id":"d217004c8dd8fa32","repo":"coleam00/Archon","slug":"path-is-not-a-git-repository-localpath-err","errorCode":null,"errorMessage":"Path is not a git repository: ${localPath} (${(error as Error).message})","messagePattern":"Path is not a git repository: (.+?) \\((.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/handlers/clone.ts","lineNumber":413,"sourceCode":"\n  // Add to git safe.directory\n  await execFileAsync('git', ['config', '--global', '--add', 'safe.directory', targetPath]);\n  getLog().debug({ path: targetPath }, 'safe_directory_added');\n\n  const result = await registerRepoAtPath(targetPath, `${ownerName}/${repoName}`, workingUrl);\n  getLog().info({ url: workingUrl, targetPath }, 'clone_completed');\n  return result;\n}\n\n/**\n * Register an existing local repository in the database (no git clone).\n */\nexport async function registerRepository(localPath: string): Promise<RegisterResult> {\n  // Validate path exists and is a git repo\n  try {\n    await execFileAsync('git', ['-C', localPath, 'rev-parse', '--git-dir']);\n  } catch (error) {\n    throw new Error(`Path is not a git repository: ${localPath} (${(error as Error).message})`);\n  }\n\n  // Git's physical common directory proves linked-checkout ownership without\n  // conflating separate clones, remotes, names, or branches (#1192).\n  const existing = await findCodebaseForCheckoutPath(localPath);\n  if (existing) {\n    return {\n      codebaseId: existing.id,\n      name: existing.name,\n      repositoryUrl: existing.repository_url,\n      defaultCwd: existing.default_cwd,\n      defaultBranch: existing.default_branch ?? null,\n      commandCount: 0,\n      alreadyExisted: true,\n    };\n  }\n\n  // Get remote URL (optional — local-only repos may not have one)","sourceCodeStart":395,"sourceCodeEnd":431,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/core/src/handlers/clone.ts#L395-L431","documentation":"Error \"Path is not a git repository: ${localPath} (${(error as Error).message})\" thrown in coleam00/Archon.","triggerScenarios":"Thrown at packages/core/src/handlers/clone.ts:413 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}