slint-ui/slint · error · Diagnostic
Could not load {}: {}
Error message
Could not load {}: {} What it means
Error "Could not load {}: {}" thrown in slint-ui/slint.
Source
Thrown at internal/compiler/diagnostics.rs:204
Utf8,
Utf16,
}
pub type SourceFile = Arc<SourceFileInner>;
pub fn load_from_path(path: &Path) -> Result<String, Diagnostic> {
let string = (if path == Path::new("-") {
let mut buffer = Vec::new();
let r = std::io::stdin().read_to_end(&mut buffer);
r.and_then(|_| {
String::from_utf8(buffer)
.map_err(|err| std::io::Error::new(std::io::ErrorKind::InvalidData, err))
})
} else {
std::fs::read_to_string(path)
})
.map_err(|err| Diagnostic {
message: format!("Could not load {}: {}", path.display(), err),
span: SourceLocation {
source_file: Some(SourceFileInner::from_path_only(path.to_owned())),
span: Default::default(),
},
level: DiagnosticLevel::Error,
})?;
if path.extension().is_some_and(|e| e == "rs") {
return crate::lexer::extract_rust_macro(string).ok_or_else(|| Diagnostic {
message: "No `slint!` macro".into(),
span: SourceLocation {
source_file: Some(SourceFileInner::from_path_only(path.to_owned())),
span: Default::default(),
},
level: DiagnosticLevel::Error,
});
}
View on GitHub (pinned to 3fd8f2ec03)
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.
When it happens
Trigger: Thrown at internal/compiler/diagnostics.rs:204 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of slint-ui/slint@3fd8f2ec03 (2026-08-19).
Data as JSON: /api/errors/836fa4c13e782884.
Report an issue: GitHub.