BloopAI/vibe-kanban · error

handled non-session commands earlier

Error message

handled non-session commands earlier

What it means

In opencode's slash_commands::execute, a match over the command kind builds a request future; session-kind commands are handled in the match arms, and the catch-all asserts `unreachable!("handled non-session commands earlier")`. Panicking here means a non-session command variant reached this match, i.e. the earlier filter/dispatch that should have handled non-session commands (help, custom, etc.) was bypassed or a new variant was added.

Source

Thrown at crates/executors/src/executors/opencode/slash_commands.rs:513

                )
                .await
            })
        }
        OpencodeSlashCommand::Custom { name, arguments } => Box::pin(async move {
            sdk::session_command(
                &request_client,
                &request_base_url,
                &request_directory,
                &request_session_id,
                name,
                arguments,
                request_agent,
                request_model,
                request_model_variant,
            )
            .await
        }),
        _ => unreachable!("handled non-session commands earlier"),
    };

    let request_result = sdk::run_request_with_control(
        request_fut,
        &mut control_rx,
        &pending_approvals,
        cancel.clone(),
    )
    .await;

    if cancel.is_cancelled() {
        sdk::send_abort(&client, &config.base_url, &config.directory, &session_id).await;
        event_handle.abort();
        return Ok(());
    }

    event_handle.abort();

View on GitHub (pinned to 4deb7eca8f)

Solutions

  1. Check the backtrace for the command id/variant that reached the unreachable arm and add an explicit early handler for it.
  2. Align the earlier 'non-session commands' guard with this match so both enumerate the same variants exhaustively (prefer matching on all variants instead of a wildcard guard).
  3. Add a unit test per SlashCommand variant through execute() to catch dispatch drift when new variants are added.

Example fix

// before
_ => unreachable!("handled non-session commands earlier"),
// after
SlashCommand::NewKind { .. } => { /* handle explicitly */ }
_ => unreachable!("handled non-session commands earlier"),
Defensive patterns

Strategy: type-guard

Validate before calling

// Pre-check before execute()
fn is_session_command(cmd: &SlashCommand) -> bool {
  matches!(cmd, SlashCommand::Session{..} /* all session kinds */)
}

Prevention

When it happens

Trigger: Calling execute() with a slash command variant that is neither one of the session command arms nor filtered out earlier — e.g. a newly added SlashCommand variant not covered by the pre-dispatch, or the early guard's condition drifting out of sync with this match.

Common situations: Adding a new slash command type and updating only one of the two dispatch sites; a custom/agent command whose classification changed so it falls through to the session-only match.

Related errors


AI-assisted analysis of BloopAI/vibe-kanban@4deb7eca8f (2026-08-29). Data as JSON: /api/errors/e000301f1574429a. Report an issue: GitHub.