{"record":{"id":"7fbc93a601bb3015","repo":"astral-sh/ruff","slug":"internalerror","errorCode":"InternalError","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":400,"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":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/astral-sh/ruff/blob/672bb4edf04c84f8b0753346359daee4057158f2/crates/ty_server/src/server/api.rs#L382-L418","documentation":"A request handler ran but returned an error that is not a salsa cancellation; api.rs wraps it as `request handler {error}` and responds with LSP InternalError, also surfacing a message to the editor ('ty failed to handle a request...'). The inner cause is only visible in the server's tracing log.","triggerScenarios":"Any unexpected failure inside a handler: a file deleted between didOpen and hover, invalid state after rapid edits, a bug in the handler, or an unwound panic in a background request task.","commonSituations":"Hover/completion racing a file rename or git branch switch, very large or corrupt files, or a genuine ty bug — the user sees an error toast from the editor.","solutions":["Check the server log (stderr/tracing) for the inner `{error}` cause — that is the real failure","Retry the same request after edits settle (transient races usually clear)","Update ty; internal handler errors are frequently fixed bugs","If reproducible, minimize the file + keystrokes and file a ty issue with the log"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// TS: retry once after a short delay, then surface the toast only once\nasync function requestSafe<T>(method: string, params: unknown): Promise<T | null> {\n  for (let attempt = 0; attempt < 2; attempt++) {\n    try { return await client.sendRequest(method, params); }\n    catch (e: any) {\n      if (e?.code !== -32603) throw e;\n      await sleep(250);\n    }\n  }\n  return null;\n}","preventionTips":["Keep the server's tracing log accessible — the InternalError text the client sees hides the real cause","Retry transient requests (hover, completion) once after edits settle before reporting","Pin a known-good ty version; check release notes for handler-fixing patches"],"tags":["lsp","internal-error","handler","panic","race-condition"],"backgroundTag":null,"analyzedSha":"672bb4edf04c84f8b0753346359daee4057158f2","analyzedAt":"2026-08-16T08:54:05.464Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}