agalwood/Motrix · warning · AppError
TaskNotFound
TaskNotFound
Error message
Task not found: ${taskId} What it means
Thrown by the Task Inspector Activity query after the taskId is validated and the underlying reader.snapshot(taskId) is called: if the reader returns null/undefined, no activity snapshot exists for that task and TaskNotFound is raised. The taskId is included in the message.
Source
Thrown at src/core/inspector-activity/task-inspector-activity-query.ts:63
return invalid()
}
const descriptor = Object.getOwnPropertyDescriptor(params, 'taskId')
if (!descriptor || !('value' in descriptor)) {
return invalid()
}
let taskId: string
try {
taskId = assertTaskId(descriptor.value as string)
} catch {
return invalid()
}
queryCount += 1
if (options.failAfterFirstQuery && queryCount > 1) {
throw new Error('deterministic Task Inspector Activity query failure')
}
const result = reader.snapshot(taskId)
if (result == null) {
throw new AppError(ErrorCode.TaskNotFound, `Task not found: ${taskId}`)
}
const snapshot = parseTaskInspectorActivitySnapshot(result, taskId)
if (!snapshot) {
throw new Error('Invalid Task Inspector Activity snapshot')
}
return snapshot
},
}
}
View on GitHub (pinned to 1a708ee577)
Solutions
- Verify the taskId exists in the task list before requesting activity.
- Refresh the source of the taskId (it may be stale).
- Handle TaskNotFound in the UI by clearing the inspector panel rather than crashing.
- Ensure you are querying the same session/profile that owns the task.
Example fix
// before
const snap = query.snapshot({ taskId: maybeStaleId }) // throws TaskNotFound
// after — guard before calling
if (!taskList.has(maybeStaleId)) {
inspector.clear()
return
}
const snap = query.snapshot({ taskId: maybeStaleId }) Defensive patterns
Strategy: validation
Validate before calling
// Confirm the task exists before requesting its activity snapshot.
if (!taskStore.has(taskId)) {
inspector.clear()
return
}
const snap = query.snapshot({ taskId }) Type guard
function taskExists(store: { has(id: string): boolean }, id: string): boolean {
return store.has(id)
} Try / catch
try {
return query.snapshot({ taskId })
} catch (err) {
if (err instanceof AppError && err.code === ErrorCode.TaskNotFound) {
inspector.clear()
return null
}
throw err
} Prevention
- Refresh the task list before opening the inspector.
- Clear cached taskIds when tasks are deleted.
- Handle TaskNotFound gracefully in the UI.
- Query the same session/profile that owns the task.
When it happens
Trigger: reader.snapshot(taskId) returns null (or undefined) for a taskId that passed assertTaskId. The task identifier is well-formed but unknown to the activity store.
Common situations: Querying an activity snapshot for a task id that was never created, was deleted, belongs to another session/profile, or whose activity log has been pruned; a stale taskId cached in the UI after the task was removed.
Related errors
- Invalid Task Inspector Activity snapshot
- taskId must be a string
- taskId must contain between 1 and ${MAX_TASK_ID_LENGTH} char
- plugin.fs.not_found
- plugin.fs.too_many_readers
AI-assisted analysis of agalwood/Motrix@1a708ee577 (2026-08-12).
Data as JSON: /api/errors/16b1dc34c7f552da.
Report an issue: GitHub.