{"record":{"id":"9203ac100365bf00","repo":"rust-lang/rust-analyzer","slug":"unable-to-make-path-absolute","errorCode":null,"errorMessage":"Unable to make path absolute","messagePattern":"Unable to make path absolute","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/rust-analyzer/src/discover.rs","lineNumber":106,"sourceCode":"#[serde(rename_all = \"snake_case\")]\nenum DiscoverProjectData {\n    Finished { buildfile: Utf8PathBuf, project: ProjectJsonData },\n    Error { error: String, source: Option<String> },\n    Progress { message: String },\n}\n\n#[derive(Debug, PartialEq, Clone)]\npub(crate) enum DiscoverProjectMessage {\n    Finished { project: ProjectJsonData, buildfile: AbsPathBuf },\n    Error { error: String, source: Option<String> },\n    Progress { message: String },\n}\n\nimpl DiscoverProjectMessage {\n    fn new(data: DiscoverProjectData) -> Self {\n        match data {\n            DiscoverProjectData::Finished { project, buildfile, .. } => {\n                let buildfile = buildfile.try_into().expect(\"Unable to make path absolute\");\n                DiscoverProjectMessage::Finished { project, buildfile }\n            }\n            DiscoverProjectData::Error { error, source } => {\n                DiscoverProjectMessage::Error { error, source }\n            }\n            DiscoverProjectData::Progress { message } => {\n                DiscoverProjectMessage::Progress { message }\n            }\n        }\n    }\n}\n\nstruct DiscoverProjectParser;\n\nimpl JsonLinesParser<DiscoverProjectMessage> for DiscoverProjectParser {\n    fn from_line(&self, line: &str, _error: &mut String) -> Option<DiscoverProjectMessage> {\n        match serde_json::from_str::<DiscoverProjectData>(line) {\n            Ok(data) => {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/rust-lang/rust-analyzer/blob/e8f7e90aa3e7b26aa9a000200f606c1078da99ec/crates/rust-analyzer/src/discover.rs#L88-L124","documentation":"An `expect` panic guard in `DiscoverProjectMessage::new`: when converting the deserialized `DiscoverProjectData::Finished` into a `DiscoverProjectMessage`, the `buildfile` path reported by the discover command is converted to an absolute path and `try_into`/absolutization is `expect`ed to succeed. It fires when the external discover tool reports a build file path that is not absolute (or not normalized), meaning the tool's output violates the contract.","triggerScenarios":"Thrown at crates/rust-analyzer/src/discover.rs:106 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the discover command to always emit absolute build-file paths","Make absolutization robust: join relative paths against the workspace root before converting to `AbsPathBuf` instead of expecting success","Replace the `expect` with an error variant (`stdx::never!` plus fallback) so a malformed tool response cannot panic the server"],"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"}