risingwavelabs/risingwave · warning · ErrorCode

Task not found

Error message

Task not found

What it means

RisingWave frontend's ErrorCode::TaskNotFound unit variant, rendered as "Task not found". It is returned when an operation references a query/batch task (e.g. canceling or querying its status) that the frontend no longer tracks — it never existed, already completed, or was purged.

Solutions

  1. Treat it as benign if the goal was cancellation — the task is already gone/finished.
  2. Re-submit the operation against a task ID obtained from the same frontend node that owns the task.
  3. Ensure cancel/status RPCs for a session's tasks go to the same frontend (sticky routing).
  4. Check whether the frontend restarted, discarding in-memory task state.

Example fix

// before
await client.cancel(taskId) // throws if already finished
// after
try { await client.cancel(taskId) } catch (e) { if (isTaskNotFound(e)) return; throw e; }
Defensive patterns

Strategy: try-catch

Validate before calling

// before cancel
const live = await listRunningTasks(); if (!live.includes(taskId)) return 'already-finished';

Try / catch

try { await cancel(taskId) } catch (e) {
  if (/Task not found/.test(e.message)) return 'already finished';
  throw e;
}

Prevention

When it happens

Trigger: Canceling a batch query whose task ID is no longer registered with the frontend; polling status of a finished/expired task; racing between task completion and a cancel request.

Common situations: Client cancels a query just as it finishes; a load balancer routes a cancel to a different frontend node than the one holding the task; stale task IDs cached by an application after restart.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/f175bb6f9403fc83. Report an issue: GitHub.

Appendix: source

Thrown at src/frontend/src/error.rs:149

        #[backtrace]
        CastError,
    ),
    #[error("Catalog error: {0}")]
    CatalogError(
        #[source]
        #[backtrace]
        #[message]
        BoxedError,
    ),
    #[error("Protocol error: {0}")]
    ProtocolError(#[message] String),
    #[error("Scheduler error: {0}")]
    SchedulerError(
        #[source]
        #[backtrace]
        BoxedError,
    ),
    #[error("Task not found")]
    TaskNotFound,
    #[error("Session not found")]
    SessionNotFound,
    #[error("Invalid reference: {0}")]
    InvalidReference(String),
    #[error("Item not found: {0}")]
    ItemNotFound(String),
    #[error("Duplicate Relation Name: {0}")]
    DuplicateRelationName(String),
    #[error("Invalid insert operation: {0}")]
    InsertViolation(String),
    #[error("Invalid input syntax: {0}")]
    InvalidInputSyntax(#[message] String),
    #[error("Cannot compare in memory: {0}")]
    MemComparableError(#[from] memcomparable::Error),
    #[error("Error while de/se values: {0}")]
    ValueEncodingError(
        #[from]

View on GitHub (pinned to 6469eb736d)