{"record":{"id":"845a82478e3a2506","repo":"eyaltoledano/claude-task-master","slug":"no-active-workflow-start-or-resume-a-workflow-fir","errorCode":null,"errorMessage":"No active workflow. Start or resume a workflow first.","messagePattern":"No active workflow\\. Start or resume a workflow first\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/workflow/services/workflow.service.ts","lineNumber":296,"sourceCode":"\t\t\tawait this.stateManager.save(newState);\n\t\t});\n\n\t\t// Initialize activity logger to continue tracking events\n\t\tthis.activityLogger = new WorkflowActivityLogger(\n\t\t\tthis.orchestrator,\n\t\t\tthis.stateManager.getActivityLogPath()\n\t\t);\n\t\tthis.activityLogger.start();\n\n\t\treturn this.getStatus();\n\t}\n\n\t/**\n\t * Get current workflow status\n\t */\n\tgetStatus(): WorkflowStatus {\n\t\tif (!this.orchestrator) {\n\t\t\tthrow new Error('No active workflow. Start or resume a workflow first.');\n\t\t}\n\n\t\tconst context = this.orchestrator.getContext();\n\t\tconst progress = this.orchestrator.getProgress();\n\t\tconst currentSubtask = this.orchestrator.getCurrentSubtask();\n\n\t\treturn {\n\t\t\ttaskId: context.taskId,\n\t\t\tphase: this.orchestrator.getCurrentPhase(),\n\t\t\ttddPhase: this.orchestrator.getCurrentTDDPhase(),\n\t\t\tbranchName: context.branchName,\n\t\t\tcurrentSubtask: currentSubtask\n\t\t\t\t? {\n\t\t\t\t\t\tid: currentSubtask.id,\n\t\t\t\t\t\ttitle: currentSubtask.title,\n\t\t\t\t\t\tattempts: currentSubtask.attempts,\n\t\t\t\t\t\tmaxAttempts: currentSubtask.maxAttempts || 3\n\t\t\t\t\t}","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/workflow/services/workflow.service.ts#L278-L314","documentation":"WorkflowService.getStatus() reads status from an internal WorkflowOrchestrator that only exists after startWorkflow() or resumeWorkflow() creates it. If this.orchestrator is undefined (no workflow was ever started in this session, or it was finalized/aborted which sets it to undefined), the service throws instead of returning a null/empty status. It is a guard against querying a lifecycle that does not exist.","triggerScenarios":"Calling getStatus() (directly or via startWorkflow/resumeWorkflow/completePhase/commit/finalizeWorkflow return paths) on a fresh WorkflowService instance; calling it after finalizeWorkflow() or abortWorkflow() cleared this.orchestrator; calling it before startWorkflow() in a new process where no persisted state was resumed.","commonSituations":"An MCP autopilot_status call issued before autopilot_start; a long-running agent session restarted and the caller forgot to resumeWorkflow(); calling finalizeWorkflow() twice (the second call hits this because orchestrator is undefined after the first); state file deleted while the service still thinks it might resume.","solutions":["Call startWorkflow() (or resumeWorkflow() if persisted state exists) before any status queries","Check the error message and route the caller to start a workflow; e.g. catch and call resumeWorkflow() if a state file exists","Do not call status-returning APIs after finalizeWorkflow()/abortWorkflow(); treat the workflow as done","If a state file exists but the in-memory orchestrator is gone, construct a new WorkflowService and resumeWorkflow()"],"exampleFix":"// before\nconst status = workflowService.getStatus();\n// after\nlet status;\ntry {\n  status = workflowService.getStatus();\n} catch {\n  status = await workflowService.resumeWorkflow(); // or startWorkflow(...) if no state\n}","handlingStrategy":"try-catch","validationCode":"// assume workflowService exposes hasActiveWorkflow or track started state yourself\nfunction canGetStatus(svc: WorkflowService, startedInProcess: boolean): boolean {\n  return startedInProcess || hasStateFile('.taskmaster/workflow-state.json');\n}","typeGuard":"function isNoActiveWorkflowError(e: unknown): e is Error {\n  return e instanceof Error && e.message.includes('No active workflow');\n}","tryCatchPattern":"try {\n  const status = workflowService.getStatus();\n} catch (e) {\n  if (isNoActiveWorkflowError(e)) {\n    const status = await workflowService.resumeWorkflow(); // or startWorkflow()\n  } else throw e;\n}","preventionTips":["Always start or resume the workflow as the first step in any session using WorkflowService","Never call status APIs after finalizeWorkflow()/abortWorkflow(); capture the returned final status instead","Track workflow liveness in your own session state if you create multiple WorkflowService instances","Check for the persisted state file to decide between startWorkflow() and resumeWorkflow()"],"tags":["workflow","lifecycle","state"],"backgroundTag":"no-active-workflow","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}