{"record":{"id":"b5360bebc4c706b8","repo":"rust-lang/rust-analyzer","slug":"unable-to-deserialize-message","errorCode":null,"errorMessage":"Unable to deserialize message","messagePattern":"Unable to deserialize message","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/rust-analyzer/src/discover.rs","lineNumber":152,"sourceCode":"    }\n\n    fn from_eof(&self) -> Option<DiscoverProjectMessage> {\n        None\n    }\n\n    fn from_stderr_line(&self, line: &str, _error: &mut String) -> Option<DiscoverProjectMessage> {\n        tracing::info!(%line, \"discover command stderr\");\n        None\n    }\n}\n\n#[test]\nfn test_deserialization() {\n    let message = r#\"\n    {\"kind\": \"progress\", \"message\":\"querying build system\",\"input\":{\"files\":[\"src/main.rs\"]}}\n    \"#;\n    let message: DiscoverProjectData =\n        serde_json::from_str(message).expect(\"Unable to deserialize message\");\n    assert!(matches!(message, DiscoverProjectData::Progress { .. }));\n\n    let message = r#\"\n    {\"kind\": \"error\", \"error\":\"failed to deserialize command output\",\"source\":\"command\"}\n    \"#;\n\n    let message: DiscoverProjectData =\n        serde_json::from_str(message).expect(\"Unable to deserialize message\");\n    assert!(matches!(message, DiscoverProjectData::Error { .. }));\n\n    let message = r#\"\n    {\"kind\": \"finished\", \"project\": {\"sysroot\": \"foo\", \"crates\": [], \"runnables\": []}, \"buildfile\":\"rust-analyzer/BUILD\"}\n    \"#;\n\n    let message: DiscoverProjectData =\n        serde_json::from_str(message).expect(\"Unable to deserialize message\");\n    assert!(matches!(message, DiscoverProjectData::Finished { .. }));\n}","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/rust-lang/rust-analyzer/blob/e8f7e90aa3e7b26aa9a000200f606c1078da99ec/crates/rust-analyzer/src/discover.rs#L134-L170","documentation":"An `expect` message on `serde_json::from_str` in the `test_deserialization` unit test: it fails when the inline JSON-LD-style discover message fixture cannot be parsed into `DiscoverProjectData`. Because it sits in a test, it fires only when the serde derive on `DiscoverProjectData` (field renames, snake_case tagging, shape) drifts out of sync with the documented wire format — the input at fault is the fixture JSON and the enum's serde attributes.","triggerScenarios":"Thrown at crates/rust-analyzer/src/discover.rs:152 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Compare the fixture JSON keys with the `#[serde(...)]` attributes on `DiscoverProjectData` after any change to the wire format","Update the fixture to match the current snake_case/`kind` tag encoding when the protocol evolves intentionally","Add fixtures for each message variant (finished/error/progress) so deserialization drift is caught per-variant"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}