{"record":{"id":"3050dbccd2bcff3f","repo":"eyaltoledano/claude-task-master","slug":"not-a-git-repository-this-projectpath-please-r","errorCode":null,"errorMessage":"not a git repository: ${this.projectPath}\nPlease run this command from within a git repository, or initialize one with 'git init'.","messagePattern":"not a git repository: (.+?)\nPlease run this command from within a git repository, or initialize one with 'git init'\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/git/adapters/git-adapter.ts","lineNumber":191,"sourceCode":"\t\t\tthrow new Error(`Repository validation failed: ${errorMessage}`);\n\t\t}\n\t}\n\n\t/**\n\t * Ensures we're in a valid git repository before performing operations.\n\t * Convenience method that throws descriptive errors.\n\t *\n\t * @returns {Promise<void>}\n\t * @throws {Error} If not in a valid git repository\n\t *\n\t * @example\n\t * await git.ensureGitRepository();\n\t * // Safe to perform git operations after this\n\t */\n\tasync ensureGitRepository(): Promise<void> {\n\t\tconst isRepo = await this.isGitRepository();\n\t\tif (!isRepo) {\n\t\t\tthrow new Error(\n\t\t\t\t`not a git repository: ${this.projectPath}\\n` +\n\t\t\t\t\t`Please run this command from within a git repository, or initialize one with 'git init'.`\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the working tree is clean (no uncommitted changes).\n\t * A clean working tree has no staged, unstaged, or untracked files.\n\t *\n\t * @returns {Promise<boolean>} True if working tree is clean\n\t *\n\t * @example\n\t * const isClean = await git.isWorkingTreeClean();\n\t * if (!isClean) {\n\t *   console.log('Working tree has uncommitted changes');\n\t * }\n\t */","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/git/adapters/git-adapter.ts#L173-L209","documentation":"ensureGitRepository() checks isGitRepository() and throws when the configured projectPath is not inside a git working tree. It is a guard used by execute() and startWorkflow() so git operations never run against a non-repo directory. The message includes the offending path and suggests running 'git init'.","triggerScenarios":"Calling execute() or startWorkflow(), or ensureGitRepository() directly, when this.projectPath has no .git directory (or is not under one), e.g. wrong projectPath passed to the adapter or running the CLI outside a repo.","commonSituations":"Running a taskmaster command from a freshly created project folder; projectPath pointing at a subdirectory of a non-repo; CI checkout using archive/tarball downloads instead of git clone (no .git).","solutions":["cd into a directory inside your git repository before running the command.","Initialize a repo if intended: git init && git add -A && git commit -m 'initial'.","Verify the adapter's projectPath option points at the repo root, not an unrelated folder.","In CI, use a real git checkout (actions/checkout, git clone) instead of artifact downloads."],"exampleFix":"// before\nnpx tm start-workflow  # run in ~/new-project (no .git)\n// after\ncd ~/my-git-project && git init 2>/dev/null; npx tm start-workflow","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nimport path from 'path';\nfunction looksLikeGitRepo(dir: string): boolean {\n  let d = path.resolve(dir);\n  while (true) {\n    if (existsSync(path.join(d, '.git'))) return true;\n    const parent = path.dirname(d);\n    if (parent === d) return false;\n    d = parent;\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await git.ensureGitRepository();\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('not a git repository')) {\n    console.error(`Initialize a repo first: cd ${process.cwd()} && git init`);\n    process.exitCode = 1;\n    return;\n  }\n  throw e;\n}","preventionTips":["Always resolve projectPath to a directory containing .git before constructing the adapter.","Call ensureGitRepository() early in CLI entrypoints, before any work is done.","In CI, use real git checkouts, not archive/tarball artifacts.","Document in onboarding that commands must run from inside a repo."],"tags":["git","repository","configuration"],"backgroundTag":"not-a-git-repository","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}