eyaltoledano/claude-task-master · error
No active workflow. Start or resume a workflow first.
Error message
No active workflow. Start or resume a workflow first.
What it means
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.
Source
Thrown at packages/tm-core/src/modules/workflow/services/workflow.service.ts:296
await this.stateManager.save(newState);
});
// Initialize activity logger to continue tracking events
this.activityLogger = new WorkflowActivityLogger(
this.orchestrator,
this.stateManager.getActivityLogPath()
);
this.activityLogger.start();
return this.getStatus();
}
/**
* Get current workflow status
*/
getStatus(): WorkflowStatus {
if (!this.orchestrator) {
throw new Error('No active workflow. Start or resume a workflow first.');
}
const context = this.orchestrator.getContext();
const progress = this.orchestrator.getProgress();
const currentSubtask = this.orchestrator.getCurrentSubtask();
return {
taskId: context.taskId,
phase: this.orchestrator.getCurrentPhase(),
tddPhase: this.orchestrator.getCurrentTDDPhase(),
branchName: context.branchName,
currentSubtask: currentSubtask
? {
id: currentSubtask.id,
title: currentSubtask.title,
attempts: currentSubtask.attempts,
maxAttempts: currentSubtask.maxAttempts || 3
}View on GitHub (pinned to c0c98d367c)
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()
Example fix
// before
const status = workflowService.getStatus();
// after
let status;
try {
status = workflowService.getStatus();
} catch {
status = await workflowService.resumeWorkflow(); // or startWorkflow(...) if no state
} Defensive patterns
Strategy: try-catch
Validate before calling
// assume workflowService exposes hasActiveWorkflow or track started state yourself
function canGetStatus(svc: WorkflowService, startedInProcess: boolean): boolean {
return startedInProcess || hasStateFile('.taskmaster/workflow-state.json');
} Type guard
function isNoActiveWorkflowError(e: unknown): e is Error {
return e instanceof Error && e.message.includes('No active workflow');
} Try / catch
try {
const status = workflowService.getStatus();
} catch (e) {
if (isNoActiveWorkflowError(e)) {
const status = await workflowService.resumeWorkflow(); // or startWorkflow()
} else throw e;
} Prevention
- 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()
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Workflow has been aborted
- Cannot finalize workflow in ${phase} phase. Complete all sub
- CONFIG_ERROR
- CONFIG_ERROR
- Workflow state file not found at ${this.statePath}
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/845a82478e3a2506.
Report an issue: GitHub.