risingwavelabs/risingwave · warning · ErrorCode

Session not found

Error message

Session not found

What it means

RisingWave frontend's ErrorCode::SessionNotFound unit variant, rendered as "Session not found". It is returned when an operation targets a client session that the frontend no longer knows — for example KILL of a local process whose session ID is absent (src/frontend/src/handler/kill_process.rs:71).

Solutions

  1. List live sessions first (SHOW PROCESSLIST equivalent) and KILL only an ID that is currently present.
  2. Ensure the KILL request reaches the same frontend node that owns the session (direct connection or sticky routing).
  3. Retry only if the target was expected to exist; otherwise treat as benign — the session already ended.
  4. Re-fetch the process ID right before issuing KILL to avoid acting on stale data.

Example fix

// before
KILL 42; -- guessed id
// after
-- from processlist output, pick a live id
KILL <id_from_show_processlist>;
Defensive patterns

Strategy: validation

Validate before calling

-- before KILL
SELECT process_id FROM rw_processlist WHERE process_id = <pid>;

Try / catch

try { await kill(pid) } catch (e) {
  if (/Session not found/.test(e.message)) return 'session already gone';
  throw e;
}

Prevention

When it happens

Trigger: Running KILL <process_id> (handle_kill_local) with an ID that does not match any live session on this frontend; targeting a session after it disconnected or the frontend restarted.

Common situations: KILLing a query that already finished; KILL routed by a load balancer to a different frontend node than the one owning the session; stale PID captured before a frontend 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/78ac7c562a7b2634. Report an issue: GitHub.

Appendix: source

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

    ),
    #[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]
        #[backtrace]
        ValueEncodingError,

View on GitHub (pinned to 6469eb736d)