{"record":{"id":"cbc1445fe9929d6b","repo":"eyaltoledano/claude-task-master","slug":"not-git-repository","errorCode":"NOT_GIT_REPOSITORY","errorMessage":"Not in a git repository. Cannot create tag from branch.","messagePattern":"Not in a git repository\\. Cannot create tag from branch\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/create-tag-from-branch.js","lineNumber":85,"sourceCode":"\t\t\tlog.error('createTagFromBranchDirect called without projectRoot');\n\t\t\tdisableSilentMode();\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'MISSING_ARGUMENT',\n\t\t\t\t\tmessage: 'projectRoot is required'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// Check if we're in a git repository\n\t\tif (!(await isGitRepository(projectRoot))) {\n\t\t\tlog.error('Not in a git repository');\n\t\t\tdisableSilentMode();\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'NOT_GIT_REPOSITORY',\n\t\t\t\t\tmessage: 'Not in a git repository. Cannot create tag from branch.'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// Determine branch name\n\t\tlet targetBranch = branchName;\n\t\tif (!targetBranch) {\n\t\t\ttargetBranch = await getCurrentBranch(projectRoot);\n\t\t\tif (!targetBranch) {\n\t\t\t\tlog.error('Could not determine current git branch');\n\t\t\t\tdisableSilentMode();\n\t\t\t\treturn {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: 'NO_CURRENT_BRANCH',\n\t\t\t\t\t\tmessage: 'Could not determine current git branch'\n\t\t\t\t\t}","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/create-tag-from-branch.js#L67-L103","documentation":"This error is returned by the create-tag-from-branch MCP direct function when the provided projectRoot is not inside a git working tree. Creating a tag from the current branch requires git metadata (current branch, commits), so the function pre-checks with isGitRepository() and refuses to run. It is a structured {success:false,error:{code:'NOT_GIT_REPOSITORY'}} response, not a thrown exception.","triggerScenarios":"Calling the create_tag_from_branch MCP tool with a projectRoot that is a plain directory, a path outside any .git tree, or a path where git init was never run. Also occurs when projectRoot points to a subdirectory resolved incorrectly or a container path lacking the mounted .git directory.","commonSituations":"Running the MCP server with a default working directory that is not the repo; passing an absolute path that was gitignored or volume-mounted without .git; pointing projectRoot at the parent folder above the repository; freshly cloned projects where .git was removed by an archive download (ZIP instead of git clone).","solutions":["Initialize a git repository in projectRoot: run 'git init' (and an initial commit).","Verify projectRoot points at the directory containing .git; correct the projectRoot argument passed to the MCP tool.","Run 'git -C <projectRoot> rev-parse --is-inside-work-tree' to confirm git recognizes the path.","If running in Docker/CI, mount the full repository including the .git directory instead of an exported copy."],"exampleFix":"// before\nawait createTagFromBranchDirect({ projectRoot: '/tmp/workspace' });\n// after\n// ensure /tmp/workspace is a repo:\n//   cd /tmp/workspace && git init && git add . && git commit -m init\nawait createTagFromBranchDirect({ projectRoot: '/tmp/my-git-repo' });","handlingStrategy":"validation","validationCode":"const { execSync } = require('child_process');\nfunction isGitRepo(root) {\n  try {\n    execSync('git rev-parse --is-inside-work-tree', { cwd: root, stdio: 'ignore' });\n    return true;\n  } catch { return false; }\n}\nif (!isGitRepo(projectRoot)) throw new Error(`${projectRoot} is not a git repository`);","typeGuard":"function isGitRepoResult(r) {\n  return r !== null && typeof r === 'object' && r.success === true;\n}","tryCatchPattern":"const res = await createTagFromBranchDirect(args);\nif (!res.success && res.error?.code === 'NOT_GIT_REPOSITORY') {\n  // surface guidance: run `git init` or fix projectRoot\n}","preventionTips":["Always resolve projectRoot to the directory containing .git, not an arbitrary cwd.","Run 'git rev-parse --is-inside-work-tree' in deployment checks before enabling tag tools.","In containers, mount the whole repo including .git.","Clone repos with git, never from ZIP archives, in CI environments."],"tags":["git","mcp-server","configuration","validation"],"backgroundTag":"not-a-git-repository","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}