astral-sh/ruff · error · ruff_server::server::api::Error

-32602

-32602

Error message

No kind was given for code action

What it means

Error "No kind was given for code action" thrown in astral-sh/ruff.

Source

Thrown at crates/ruff_server/src/server/api/requests/code_action_resolve.rs:58

        snapshot: Self::Snapshot,
        _client: &Client,
        mut action: types::CodeAction,
    ) -> Result<types::CodeAction> {
        let snapshot = match snapshot {
            Ok(snapshot) => snapshot,
            Err(err) => {
                tracing::warn!("Returning code action unchanged because {err}.");
                return Ok(action);
            }
        };

        let query = snapshot.query();

        let code_actions = SupportedCodeAction::from_kind(
            action
                .kind
                .clone()
                .ok_or(anyhow::anyhow!("No kind was given for code action"))
                .with_failure_code(ErrorCode::InvalidParams)?,
        )
        .collect::<Vec<_>>();

        // Ensure that the code action maps to _exactly one_ supported code action
        let [action_kind] = code_actions.as_slice() else {
            return Err(anyhow::anyhow!(
                "Code action resolver did not expect code action kind {:?}",
                action.kind.as_ref().unwrap()
            ))
            .with_failure_code(ErrorCode::InvalidParams);
        };

        match action_kind {
            SupportedCodeAction::SourceFixAll | SupportedCodeAction::SourceOrganizeImports
                if snapshot.is_notebook_cell() =>
            {
                // This should never occur because we ignore generating these code actions for a

View on GitHub (pinned to 672bb4edf0)

When it happens

Trigger: Thrown at crates/ruff_server/src/server/api/requests/code_action_resolve.rs:58 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of astral-sh/ruff@672bb4edf0 (2026-08-16). Data as JSON: /api/errors/4c5cb9525421d577. Report an issue: GitHub.