{"record":{"id":"dfb0be4b1d4c282d","repo":"eyaltoledano/claude-task-master","slug":"required-pathtype-not-found-searched-defaul","errorCode":null,"errorMessage":"Required ${pathType} not found. Searched: ${defaultPaths.join(', ')}","messagePattern":"Required (.+?) not found\\. Searched: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task-master.js","lineNumber":208,"sourceCode":"\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`${pathType} override path does not exist: ${resolvedPath}`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn resolvedPath;\n\t\t}\n\n\t\tif (override === true) {\n\t\t\t// Required path - search defaults and fail if not found\n\t\t\tfor (const defaultPath of defaultPaths) {\n\t\t\t\tconst fullPath = path.isAbsolute(defaultPath)\n\t\t\t\t\t? defaultPath\n\t\t\t\t\t: path.join(basePath || process.cwd(), defaultPath);\n\t\t\t\tif (fs.existsSync(fullPath)) {\n\t\t\t\t\treturn fullPath;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow new Error(\n\t\t\t\t`Required ${pathType} not found. Searched: ${defaultPaths.join(', ')}`\n\t\t\t);\n\t\t}\n\n\t\t// Optional path (override === false/undefined) - search defaults, return null if not found\n\t\tfor (const defaultPath of defaultPaths) {\n\t\t\tconst fullPath = path.isAbsolute(defaultPath)\n\t\t\t\t? defaultPath\n\t\t\t\t: path.join(basePath || process.cwd(), defaultPath);\n\t\t\tif (fs.existsSync(fullPath)) {\n\t\t\t\treturn fullPath;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t};\n\n\tconst paths = {};","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/src/task-master.js#L190-L226","documentation":"When a path is marked required (override === true) and none of the candidate default locations contain the file/directory, resolvePath() throws with the list of paths it searched. This indicates the project is missing a mandatory taskmaster artifact (e.g. PRD, config, tasks file) in every standard location relative to basePath or process.cwd().","triggerScenarios":"Running a command that requires e.g. the PRD file in a project that has never had one created; running from the wrong directory so basePath defaults to an empty project; required override true with no explicit path and the file deleted after creation.","commonSituations":"Fresh clones missing git-ignored .taskmaster artifacts; running the CLI outside the project root in CI; a teammate deleting the required file while config still marks it required; project initialized with a different directory layout than the searched defaults.","solutions":["Create the required file in one of the listed searched locations (the message enumerates them).","Run the init/creation command that generates the missing artifact (e.g. task-master init or init-prd).","Run the CLI from the project root, or pass an explicit override path via config/flags.","Pass basePath explicitly if the defaults should be resolved relative to a non-cwd root."],"exampleFix":"// before\ncd ~/ && task-master list   // cwd has no .taskmaster\n// after\ncd /path/to/my-project && task-master list\n// or\nmkdir -p .taskmaster && task-master init","handlingStrategy":"fallback","validationCode":"function firstExisting(paths) {\n  return paths.find((p) => fs.existsSync(p)) ?? null;\n}\nconst found = firstExisting(defaultCandidates);\nif (!found) {\n  // create the artifact or chdir to the project root before invoking\n  fs.mkdirSync('.taskmaster', { recursive: true });\n}\n","typeGuard":null,"tryCatchPattern":"try {\n  paths.prd = tm.resolvePath({ prdPath: true }); // required\n} catch (err) {\n  if (err.message.startsWith('Required') && err.message.includes('not found. Searched:')) {\n    console.error(err.message); // lists searched locations\n    console.error('Run `task-master init` in your project root to create missing files');\n    process.exit(1);\n  }\n  throw err;\n}","preventionTips":["Always run CLI commands from the project root (or set basePath explicitly).","Commit required artifacts or generate them in CI bootstrap steps (they may be git-ignored).","Read the 'Searched:' list in the message — it tells you exactly where the file is expected.","Add an init step to CI pipelines for fresh checkouts."],"tags":["filesystem","path-resolution","missing-file","configuration"],"backgroundTag":"file-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}