slint-ui/slint · error
cannot read
Error message
cannot read {}: {err} What it means
parse_rust_enum reads the Rust source file that defines the enum it must mirror into TypeScript; this panic is the read_to_string error handler. It means the build script could not open the referenced source file — a wrong path constant, a file moved/renamed upstream, or filesystem/permission trouble during the build. The input at fault is the path passed to parse_rust_enum.
Solutions
- Check that the enum source file path passed to parse_rust_enum is correct and that the file exists in the checkout
- Verify file read permissions and that no stale CARGO_MANIFEST_DIR/out-dir redirect moved the source
- Re-clone or restore the missing source file; this is a build-time codegen input, not a runtime artifact
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at api/node/build.rs:552 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16).
Data as JSON: /api/errors/e5df1a2d061fde99.
Report an issue: GitHub.
Appendix: source
Thrown at api/node/build.rs:552
name: String,
docs: Vec<String>,
/// Whether the variant is `#[doc(hidden)]`.
hidden: bool,
fields: Vec<RustField>,
}
struct RustField {
/// `None` for a field of a tuple variant.
name: Option<String>,
js_name: Option<String>,
/// Last segment of the field's type path.
ty: String,
docs: Vec<String>,
}
fn parse_rust_enum(path: &std::path::Path, name: &str) -> RustEnum {
let source = std::fs::read_to_string(path)
.unwrap_or_else(|err| panic!("cannot read {}: {err}", path.display()));
let file = syn::parse_file(&source)
.unwrap_or_else(|err| panic!("cannot parse {}: {err}", path.display()));
let item = file
.items
.iter()
.find_map(|item| match item {
syn::Item::Enum(item) if item.ident == name => Some(item),
_ => None,
})
.unwrap_or_else(|| panic!("no `enum {name}` in {}", path.display()));
RustEnum {
docs: doc_lines(&item.attrs),
attrs: item.attrs.clone(),
variants: item
.variants
.iter()
.map(|variant| RustVariant {View on GitHub (pinned to bb937076de)