{"record":{"id":"30cbebea73fce299","repo":"can1357/oh-my-pi","slug":"git-repository-not-found-for-isolated-task-executi","errorCode":null,"errorMessage":"Git repository not found for isolated task execution.","messagePattern":"Git repository not found for isolated task execution\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/task/worktree.ts","lineNumber":67,"sourceCode":"\troot: RepoBaseline;\n\t/** Nested git repos (path relative to root.repoRoot). */\n\tnested: Array<{ relativePath: string; baseline: RepoBaseline }>;\n}\n\nexport async function getRepoRoot(cwd: string): Promise<string> {\n\t// Pure-jj check runs first so a jj workspace nested under an unrelated\n\t// outer Git checkout is rejected at its own root rather than silently\n\t// mutating the surrounding Git tree behind jj's back.\n\tif (vcs.isPureJj(cwd)) {\n\t\tthrow new Error(\n\t\t\t\"Isolated task execution requires a Git checkout, but this workspace is pure Jujutsu (`.jj/` without a colocated `.git/`). Run `jj git init --colocate` to add a Git checkout, or set `task.isolation.mode: none` to disable task isolation.\",\n\t\t);\n\t}\n\n\tconst repoRoot = vcs.git(cwd)?.info().repoRoot;\n\tif (repoRoot) return repoRoot;\n\n\tthrow new Error(\"Git repository not found for isolated task execution.\");\n}\n\nconst GIT_NO_INDEX_NULL_PATH = process.platform === \"win32\" ? \"NUL\" : \"/dev/null\";\n\nexport function getGitNoIndexNullPath(): string {\n\treturn GIT_NO_INDEX_NULL_PATH;\n}\n\n/** Find nested git repositories (non-submodule) under the given root. */\nasync function discoverNestedRepos(repoRoot: string): Promise<string[]> {\n\t// Get submodule paths so we can exclude them\n\tconst submodulePaths = new Set(await vcs.requireGit(repoRoot).submodulePaths());\n\n\t// Find all .git dirs/files that aren't the root or known submodules\n\tconst result: string[] = [];\n\tasync function walk(dir: string): Promise<void> {\n\t\tlet entries: Dirent[];\n\t\ttry {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/task/worktree.ts#L49-L85","documentation":"After passing the pure-jj check, getRepoRoot asks the VCS layer for the Git repository root; if no Git repo is detected from the working directory it throws. Isolated tasks need a real Git checkout to create worktrees in, so absence of one is fatal.","triggerScenarios":"Calling getRepoRoot/repoRoot from a directory that is neither inside a Git repository nor a pure-jj workspace — e.g. a plain folder, a Mercurial repo, or `$GIT_DIR`/env misconfiguration making `vcs.git(cwd)?.info().repoRoot` return undefined.","commonSituations":"Running omp with task isolation enabled outside any repo (home dir, temp dir, bare folder); running inside a repo whose `.git` file/dir is corrupted or removed; SVN/Mercurial-only projects.","solutions":["Run the tool from inside a Git repository (cd to your project, or `git init` if it is not one yet)","If the project is jj-based, re-init colocated: `jj git init --colocate`","Check that `.git` exists and is intact at the expected repo root"],"exampleFix":"// shell, before\n$ cd ~/notes && omp   # not a git repo\n// after\n$ cd ~/notes && git init && omp","handlingStrategy":"validation","validationCode":"import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nfunction insideGitRepo(dir: string): boolean {\n\tlet cur = path.resolve(dir);\n\twhile (true) {\n\t\tif (fs.existsSync(path.join(cur, \".git\"))) return true;\n\t\tconst parent = path.dirname(cur);\n\t\tif (parent === cur) return false;\n\t\tcur = parent;\n\t}\n}","typeGuard":null,"tryCatchPattern":"try {\n\tconst root = await getRepoRoot(cwd);\n} catch (err) {\n\tif ((err as Error).message.includes(\"Git repository not found\")) {\n\t\tthrow new Error(`Isolate tasks: ${cwd} is not a git checkout`);\n\t}\n\tthrow err;\n}","preventionTips":["Only enable task isolation inside git repositories","Verify `git rev-parse --show-toplevel` succeeds in your working dir before launching isolated tasks","Don't run isolation-requiring commands from home or temp directories"],"tags":["git","vcs","configuration"],"backgroundTag":"git-repository-not-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}