eyaltoledano/claude-task-master · error · TaskMasterError
STORAGE_ERROR
STORAGE_ERROR
Error message
Failed to get task ${taskId} What it means
TaskService.getTask wraps any non-TaskMasterError failure while fetching a task into a TaskMasterError with code STORAGE_ERROR and message 'Failed to get task <taskId>'. The underlying storage read (file or API) threw an unexpected error, which is re-thrown with operation/resource/taskId context attached.
Source
Thrown at packages/tm-core/src/modules/tasks/services/task-service.ts:210
}
/**
* Get a single task by ID - delegates to storage layer
*/
async getTask(taskId: string, tag?: string): Promise<Task | null> {
// Use provided tag or get active tag
const activeTag = tag || this.getActiveTag();
try {
// Delegate to storage layer which handles the specific logic for tasks vs subtasks
return await this.storage.loadTask(String(taskId), activeTag);
} catch (error) {
// Re-throw all TaskMasterErrors without wrapping
if (error instanceof TaskMasterError) {
throw error;
}
throw new TaskMasterError(
`Failed to get task ${taskId}`,
ERROR_CODES.STORAGE_ERROR,
{
operation: 'getTask',
resource: 'task',
taskId: String(taskId),
tag: activeTag
},
error as Error
);
}
}
/**
* Get tasks filtered by status
*/
async getTasksByStatus(
status: TaskStatus | TaskStatus[],View on GitHub (pinned to c0c98d367c)
Solutions
- Inspect error.details (operation: 'getTask', taskId) and the wrapped cause to find the root storage failure
- Verify the tasks file exists and is valid JSON for the given tag
- Confirm the process working directory matches the initialized project
- If TaskMasterError was already thrown (e.g. NOT_FOUND for the task id), handle it directly — it is re-thrapped unwrapped
- Re-authenticate if the cause is an API storage failure
Example fix
// before
const task = await taskService.getTask(5);
// after
try {
const task = await taskService.getTask(5);
} catch (e) {
if (e instanceof TaskMasterError && e.code === ERROR_CODES.STORAGE_ERROR) {
console.error(`getTask(${e.details?.taskId}) failed:`, e.cause ?? e.message);
}
throw e;
} Defensive patterns
Strategy: try-catch
Type guard
function isTaskMasterError(e: unknown): e is TaskMasterError {
return e instanceof TaskMasterError;
} Try / catch
try {
const task = await taskService.getTask(taskId);
} catch (e) {
if (e instanceof TaskMasterError) {
console.error(`getTask failed [${e.code}]:`, e.details);
}
throw e;
} Prevention
- Initialize TaskService storage before lookups
- Validate tasks.json parses (JSON.parse) in CI health checks
- Match process cwd to the initialized project directory
- Distinguish NOT_FOUND (bad taskId) from STORAGE_ERROR (storage failure) when handling
When it happens
Trigger: Calling getTask(taskId) (directly or via task/loadTask) when the storage adapter throws — e.g. malformed tasks.json, ENOENT on the tasks file, permission errors, or an API/network failure during the read.
Common situations: Corrupted or hand-edited tasks.json; project initialized in a different directory than the process runs in; API session network failures; asking for a task in a tag whose file is missing.
Related errors
- Task ID is required
- Task title is required
- Task description is required
- Task status is required
- Task ${taskId} not found
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/6895f7d362cd934b.
Report an issue: GitHub.