{"record":{"id":"836fa4c13e782884","repo":"slint-ui/slint","slug":"could-not-load","errorCode":null,"errorMessage":"Could not load {}: {}","messagePattern":"Could not load (.+?): (.+?)","errorType":"exception","errorClass":"Diagnostic","httpStatus":null,"severity":"error","filePath":"internal/compiler/diagnostics.rs","lineNumber":204,"sourceCode":"    Utf8,\n    Utf16,\n}\n\npub type SourceFile = Arc<SourceFileInner>;\n\npub fn load_from_path(path: &Path) -> Result<String, Diagnostic> {\n    let string = (if path == Path::new(\"-\") {\n        let mut buffer = Vec::new();\n        let r = std::io::stdin().read_to_end(&mut buffer);\n        r.and_then(|_| {\n            String::from_utf8(buffer)\n                .map_err(|err| std::io::Error::new(std::io::ErrorKind::InvalidData, err))\n        })\n    } else {\n        std::fs::read_to_string(path)\n    })\n    .map_err(|err| Diagnostic {\n        message: format!(\"Could not load {}: {}\", path.display(), err),\n        span: SourceLocation {\n            source_file: Some(SourceFileInner::from_path_only(path.to_owned())),\n            span: Default::default(),\n        },\n        level: DiagnosticLevel::Error,\n    })?;\n\n    if path.extension().is_some_and(|e| e == \"rs\") {\n        return crate::lexer::extract_rust_macro(string).ok_or_else(|| Diagnostic {\n            message: \"No `slint!` macro\".into(),\n            span: SourceLocation {\n                source_file: Some(SourceFileInner::from_path_only(path.to_owned())),\n                span: Default::default(),\n            },\n            level: DiagnosticLevel::Error,\n        });\n    }\n","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/slint-ui/slint/blob/3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016/internal/compiler/diagnostics.rs#L186-L222","documentation":"Error \"Could not load {}: {}\" thrown in slint-ui/slint.","triggerScenarios":"Thrown at internal/compiler/diagnostics.rs:204 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the file exists and is readable at the reported path.","Fix the underlying I/O error shown in the second message part."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3fd8f2ec03c2aa8a95d5f4b9daa299c7b8bf4016","analyzedAt":"2026-08-19T23:23:16.610Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}