{"record":{"id":"91afa36fbcc5427f","repo":"astral-sh/ruff","slug":"32603","errorCode":"-32603","errorMessage":"request handler {error}","messagePattern":"request handler (.+?)","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/ty_server/src/server/api.rs","lineNumber":402,"sourceCode":"            tracing::debug!(\n                \"request id={} method={} was cancelled by salsa, re-queueing for retry\",\n                request.id,\n                request.method\n            );\n            client.retry(request);\n        } else {\n            tracing::debug!(\n                \"request id={} was cancelled by salsa, sending content modified\",\n                id\n            );\n            respond_silent_error(id.clone(), client, R::salsa_cancellation_error());\n        }\n    } else {\n        respond::<R>(\n            id,\n            Err(Error {\n                code: lsp_server::ErrorCode::InternalError,\n                error: anyhow!(\"request handler {error}\"),\n            }),\n            client,\n            log_guidance,\n        );\n    }\n}\n\nfn sync_notification_task<N: traits::SyncNotificationHandler>(\n    notif: server::Notification,\n) -> Result<Task> {\n    let (id, params) = cast_notification::<N>(notif)?;\n    Ok(Task::sync(move |session, client| {\n        let _span = tracing::debug_span!(\"notification\", method = %N::METHOD).entered();\n        if let Err(err) = N::run(session, client, params) {\n            tracing::error!(\"An error occurred while running {id}: {err}\");\n            client.show_error_message(format!(\n                \"ty encountered a problem. {}\",\n                session.client_name().log_guidance()","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/astral-sh/ruff/blob/26f38c119cac42e4d320ba08f09224fdec74af2c/crates/ty_server/src/server/api.rs#L384-L420","documentation":"ty's LSP server wraps any request handler that panics (caught via `ruff_db::panic::catch_unwind`) into an LSP InternalError (-32603) response with the message `request handler {error}`, where `{error}` is the `PanicError` payload of the panic. It is a catch-all for bugs inside ty's request handlers rather than an error the caller caused. The panic detail and the client's `log_guidance` string are appended so the user knows where to report it.","triggerScenarios":"Any LSP request (hover, completion, code action, document diagnostics, etc.) whose handler panics - e.g. a salsa query panics, an unwrap/expect fails, or an index-out-of-bounds occurs inside `R::handle_request` - and the panic is not a `salsa::Cancelled` cancellation (cancellations are retried or reported as ContentModified instead).","commonSituations":"A genuine ty bug triggered by unusual Python source (syntax edge cases, exotic type constructs); editing many documents rapidly such that salsa invalidation races surface latent panics; running an in-development ty version against a codebase pattern the handler never expected.","solutions":["Capture the full panic message from the LSP log and the code that triggered it, and file a bug at https://github.com/astral-sh/ruff/issues (ty expects panics to be reported as bugs, not handled)","Restart/reload the language-server session; the salsa database can be left in a bad state after a panic","Try the latest ty version - the panic may already be fixed","If the panic blocks a single file, exclude that file from analysis (e.g. via lint config/ignore) as a temporary workaround"],"exampleFix":"// A handler that panics on missing data\n// before\nlet module = db.module(module_name).unwrap();\n// after\nlet Some(module) = db.module(module_name) else {\n    return Err(anyhow!(\"module {module_name} not found\"));\n};","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Client-side: handle an InternalError (-32603) response\nmatch response {\n    Ok(result) => use(result),\n    Err(err) if err.code == -32603 => {\n        log::error!(\"ty request handler panicked: {} - please report this bug\", err.message);\n        restart_language_server();\n        None // degrade gracefully\n    }\n    Err(err) => return Err(err),\n}","preventionTips":["Keep ty updated to the latest release so known handler panics are fixed","If a panic reproduces on a specific file, minimize it and file an issue with the repro","Avoid relying on the server after a panic response - restart the session before continuing","Watch the LSP logs for `request handler` messages to catch regressions early"],"tags":["lsp","internal-error","panic","rust"],"backgroundTag":"lsp-internal-error","analyzedSha":"26f38c119cac42e4d320ba08f09224fdec74af2c","analyzedAt":"2026-09-05T10:32:37.492Z","contentChangedAt":"2026-09-05T10:32:37.492Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}