{"record":{"id":"7e57a8c8b72c35e2","repo":"eyaltoledano/claude-task-master","slug":"project-path-is-required","errorCode":null,"errorMessage":"Project path is required","messagePattern":"Project path is required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/git/adapters/git-adapter.ts","lineNumber":32,"sourceCode":" */\nexport class GitAdapter {\n\tpublic projectPath: string;\n\tpublic git: SimpleGit;\n\n\t/**\n\t * Creates a new GitAdapter instance.\n\t *\n\t * @param {string} projectPath - Absolute path to the project directory\n\t * @throws {Error} If projectPath is invalid or not absolute\n\t *\n\t * @example\n\t * const git = new GitAdapter('/path/to/project');\n\t * await git.ensureGitRepository();\n\t */\n\tconstructor(projectPath: string) {\n\t\t// Validate project path\n\t\tif (!projectPath) {\n\t\t\tthrow new Error('Project path is required');\n\t\t}\n\n\t\tif (!path.isAbsolute(projectPath)) {\n\t\t\tthrow new Error('Project path must be an absolute path');\n\t\t}\n\n\t\t// Normalize path\n\t\tthis.projectPath = path.normalize(projectPath);\n\n\t\t// Initialize simple-git\n\t\tthis.git = simpleGit(this.projectPath);\n\t}\n\n\t/**\n\t * Checks if the current directory is a git repository.\n\t * Looks for .git directory or file (worktree/submodule).\n\t *\n\t * @returns {Promise<boolean>} True if in a git repository","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/git/adapters/git-adapter.ts#L14-L50","documentation":"Plain Error thrown by the GitAdapter constructor when projectPath is falsy (empty string, undefined cast to string, null, ''). The adapter validates its required inputs up front before touching git. It is a programmer-input error, not a git state problem.","triggerScenarios":"new GitAdapter(''), new GitAdapter(undefined as any), or passing a variable that is empty because an upstream lookup (config value, CLI flag, env var) returned nothing.","commonSituations":"Constructing the adapter before resolving the project root; a config file missing the project path key; process.cwd() passed as an empty variable due to a refactoring bug; optional CLI args defaulting to '' instead of undefined.","solutions":["Pass a non-empty absolute path: new GitAdapter('/abs/path/to/project')","Use process.cwd() or resolve your project root before constructing the adapter","Fix the upstream source returning empty (missing config key, unset env var, CLI flag default)","Add a pre-construction check so the failure is caught at your boundary with better context"],"exampleFix":"// before\nconst git = new GitAdapter(config.projectPath); // '' if missing\n// after\nconst projectPath = config.projectPath || process.cwd();\nif (!projectPath) throw new Error('projectPath not configured');\nconst git = new GitAdapter(projectPath);","handlingStrategy":"validation","validationCode":"if (typeof projectPath !== 'string' || projectPath.length === 0) {\n  throw new Error('projectPath must be a non-empty string before creating GitAdapter');\n}","typeGuard":"function isNonEmptyString(v: unknown): v is string {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":"try {\n  const git = new GitAdapter(projectPath);\n} catch (e) {\n  if (e.message === 'Project path is required') {\n    console.error('Configure a project path (config key/env/CLI flag)');\n  } else throw e;\n}","preventionTips":["Resolve the project path (config → env → cwd fallback) before constructing the adapter","Use non-empty string validation at your config-loading boundary","Avoid '' as a default value for path options; use undefined so fallbacks trigger","Log the resolved path before adapter construction in debugging"],"tags":["git","validation","constructor","invalid-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}