{"record":{"id":"b57ad7e9ee9177a3","repo":"eyaltoledano/claude-task-master","slug":"workflow-state-file-not-found-at-this-statepath","errorCode":null,"errorMessage":"Workflow state file not found at ${this.statePath}","messagePattern":"Workflow state file not found at (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/workflow/managers/workflow-state-manager.ts","lineNumber":121,"sourceCode":"\tasync exists(): Promise<boolean> {\n\t\ttry {\n\t\t\tawait fs.access(this.statePath);\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Load workflow state from disk\n\t */\n\tasync load(): Promise<WorkflowState> {\n\t\ttry {\n\t\t\tconst content = await fs.readFile(this.statePath, 'utf-8');\n\t\t\treturn JSON.parse(content) as WorkflowState;\n\t\t} catch (error: any) {\n\t\t\tif (error.code === 'ENOENT') {\n\t\t\t\tthrow new Error(`Workflow state file not found at ${this.statePath}`);\n\t\t\t}\n\t\t\tthrow new Error(`Failed to load workflow state: ${error.message}`);\n\t\t}\n\t}\n\n\t/**\n\t * Save workflow state to disk\n\t * Uses steno for atomic writes and automatic queueing of concurrent saves\n\t */\n\tasync save(state: WorkflowState): Promise<void> {\n\t\ttry {\n\t\t\t// Ensure writer is initialized (creates directory if needed)\n\t\t\tawait this.ensureWriter();\n\n\t\t\t// Serialize and validate JSON\n\t\t\tconst jsonContent = JSON.stringify(state, null, 2);\n\n\t\t\t// Validate that the JSON is well-formed by parsing it back","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/workflow/managers/workflow-state-manager.ts#L103-L139","documentation":"WorkflowStateManager.load() reads the workflow state JSON from `this.statePath` and throws a plain Error `Workflow state file not found at <path>` when the read fails with ENOENT. It signals that no workflow state has been persisted yet (or the configured path is wrong), as opposed to a corrupt/unreadable file.","triggerScenarios":"Calling `await stateManager.load()` before the workflow has ever been saved; statePath configured to a different project/directory than where state was saved; the state file was deleted (clean, git clean, CI fresh checkout).","commonSituations":"Fresh clone or CI run with no persisted workflow state; switching worktrees/branches where .taskmaster state is gitignored; typo'd project root so statePath points at a non-existent directory.","solutions":["Call `await stateManager.save(...)` at least once (or the workflow bootstrap that creates it) before load","Verify the process cwd/project root matches where the state file was written; fix statePath configuration","Call `existsSync(statePath)` or try/catch ENOENT and treat as 'no state yet' with a default state instead of crashing"],"exampleFix":"// before\nconst state = await stateManager.load(); // throws on fresh checkout\n// after\nlet state;\ntry {\n  state = await stateManager.load();\n} catch (e) {\n  if (String(e.message).includes('not found')) state = DEFAULT_WORKFLOW_STATE;\n  else throw e;\n}","handlingStrategy":"fallback","validationCode":"import { existsSync } from 'fs';\nif (!existsSync(statePath)) {\n  state = DEFAULT_WORKFLOW_STATE; // skip load entirely\n} else {\n  state = await stateManager.load();\n}","typeGuard":"const isNotFound = (e: unknown) =>\n  e instanceof Error && e.message.includes('Workflow state file not found');","tryCatchPattern":"let state: WorkflowState;\ntry {\n  state = await stateManager.load();\n} catch (e) {\n  if (isNotFound(e)) state = DEFAULT_WORKFLOW_STATE;\n  else throw e;\n}","preventionTips":["Save workflow state once at workflow start so load never ENOENTs","Don't gitignore/delete the state file if it is required across runs — or handle absence explicitly","Confirm process cwd/project root matches the statePath configuration","In CI/fresh checkouts, always treat missing state as first-run, not fatal"],"tags":["workflow","filesystem","missing-file"],"backgroundTag":"file-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}