{"record":{"id":"d495c5b4b41dab43","repo":"eyaltoledano/claude-task-master","slug":"not-git-repo","errorCode":"NOT_GIT_REPO","errorMessage":"Not in a git repository. Cannot use fromBranch option.","messagePattern":"Not in a git repository\\. Cannot use fromBranch option\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/add-tag.js","lineNumber":80,"sourceCode":"\t\t}\n\n\t\t// Handle --from-branch option\n\t\tif (fromBranch) {\n\t\t\tlog.info('Creating tag from current git branch');\n\n\t\t\t// Import git utilities\n\t\t\tconst gitUtils = await import(\n\t\t\t\t'../../../../scripts/modules/utils/git-utils.js'\n\t\t\t);\n\n\t\t\t// Check if we're in a git repository\n\t\t\tif (!(await gitUtils.isGitRepository(projectRoot))) {\n\t\t\t\tlog.error('Not in a git repository');\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: 'NOT_GIT_REPO',\n\t\t\t\t\t\tmessage: 'Not in a git repository. Cannot use fromBranch option.'\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Get current git branch\n\t\t\tconst currentBranch = await gitUtils.getCurrentBranch(projectRoot);\n\t\t\tif (!currentBranch) {\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}\n\t\t\t\t};\n\t\t\t}","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/add-tag.js#L62-L98","documentation":"When add_tag is called with fromBranch, the function verifies the project root is inside a git work tree using gitUtils.isGitRepository before attempting to read branch info. If git says the directory is not a repository, creation of a tag from a branch is impossible and this structured NOT_GIT_REPO error is returned.","triggerScenarios":"Calling add_tag with fromBranch: true (or a fromBranch branch name) while projectRoot is not a git repository or git metadata is unavailable.","commonSituations":"Project copied without the .git directory; running the MCP server from a subdirectory outside the repo; projectRoot misconfigured to a non-repo path; fresh project where git init was never run.","solutions":["Run 'git init' in the project root","Set projectRoot to the directory containing .git","Drop the fromBranch option and create the tag from the current tasks file instead"],"exampleFix":"// before\nadd_tag({ tasksJsonPath: path, fromBranch: true });\n// after\ngit init && add_tag({ tasksJsonPath: path, fromBranch: true });","handlingStrategy":"validation","validationCode":"import { execSync } from 'child_process';\nfunction isGitRepo(root) {\n  try { execSync('git rev-parse --is-inside-work-tree', { cwd: root, stdio: 'ignore' }); return true; }\n  catch { return false; }\n}\nif (args.fromBranch && !isGitRepo(projectRoot)) { /* fall back to non-branch tag creation */ }","typeGuard":"function canUseFromBranch(args, root) {\n  return typeof args?.fromBranch === 'boolean' && args.fromBranch && isGitRepo(root);\n}","tryCatchPattern":"const res = await addTagDirect(args);\nif (!res.success && res.error?.code === 'NOT_GIT_REPO') {\n  // retry without fromBranch or instruct user to git init\n}","preventionTips":["Run git init as part of project scaffolding","Never copy projects without the .git directory if branch-based tags are used","Verify projectRoot points at the repo root"],"tags":["git","mcp","environment"],"backgroundTag":"not-a-git-repository","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}