{"record":{"id":"a491af593cbfbed3","repo":"rust-lang/rust-analyzer","slug":"message","errorCode":null,"errorMessage":"{message}","messagePattern":"\\{message\\}","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/rust-analyzer/src/lsp/utils.rs","lineNumber":75,"sourceCode":"                        return;\n                    };\n                    if let Ok(Some(_item)) = crate::from_json::<Option<MessageActionItem>>(\n                        lsp_types::ShowMessageRequest::METHOD.as_str(),\n                        &result,\n                    ) {\n                        this.send_notification::<lsp_ext::OpenServerLogsNotification>(());\n                    }\n                },\n            ),\n            false => self.send_notification::<lsp_types::ShowMessageNotification>(\n                lsp_types::ShowMessageParams { kind, message },\n            ),\n        }\n    }\n\n    /// If `additional_info` is [`Some`], appends a note to the notification telling to check the logs.\n    /// This will always log `message` + `additional_info` to the server's error log.\n    pub(crate) fn show_and_log_error(&mut self, message: String, additional_info: Option<String>) {\n        match additional_info {\n            Some(additional_info) => {\n                tracing::error!(\"{message}:\\n{additional_info}\");\n                self.show_message(\n                    lsp_types::MessageType::Error,\n                    message,\n                    tracing::enabled!(tracing::Level::ERROR),\n                );\n            }\n            None => {\n                tracing::error!(\"{message}\");\n                self.send_notification::<lsp_types::ShowMessageNotification>(\n                    lsp_types::ShowMessageParams { kind: lsp_types::MessageType::Error, message },\n                );\n            }\n        }\n    }\n","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/rust-lang/rust-analyzer/blob/e8f7e90aa3e7b26aa9a000200f606c1078da99ec/crates/rust-analyzer/src/lsp/utils.rs#L57-L93","documentation":"show_and_log_error displays an arbitrary message string to the LSP client as a window/showMessage error notification and simultaneously logs it (with optional additional info) to the server's error log. The `{message}` itself is dynamic; it is rust-analyzer's generic channel for surfacing fatal-ish runtime problems to the user.","triggerScenarios":"Any code path calling GlobalState::show_and_log_error — notably poke_rust_analyzer_developer (developer-build warnings) and project discovery failures (handle_discover_msg) — passing a formatted message and optional extra info.","commonSituations":"Running a from-source `cargo xtask install`/POKE_RA_DEVS build that warns developers; project/workspace discovery failing so an error is shown with a hint to check logs; other internal components reporting user-visible failures.","solutions":["Read the additional info after the colon in the notification and the rust-analyzer output/error log for the root cause.","For discovery-related messages, fix the workspace/discovery configuration (linkedProjects, custom discovery command).","If it's a developer poke from a source build, it's informational — verify you built correctly (cargo xtask install vs plain cargo build).","Reproduce with RUST_LOG=error to capture the full context and file an issue if it's an internal invariant failure."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"client.onNotification(lsp.ShowMessageNotification.type, (p) => {\n  if (p.type === lsp.MessageType.Error) {\n    const [msg, info] = p.message.split(':\\n', 2);\n    log.error(msg, info ?? 'see rust-analyzer output channel');\n  }\n});","preventionTips":["Always read the text after ':\\n' — it contains the root cause detail.","Keep the rust-analyzer output channel open at error level when debugging.","Reproduce with RUST_LOG to capture the full context for bug reports."],"tags":["rust","lsp","diagnostics","notification"],"backgroundTag":"lsp-error-notification","analyzedSha":"e8f7e90aa3e7b26aa9a000200f606c1078da99ec","analyzedAt":"2026-09-03T21:08:06.959Z","contentChangedAt":"2026-09-03T21:08:06.959Z","schemaVersion":2},"datasetVersion":"2026-09-11T07:07:21.782Z"}