slint-ui/slint · critical
native item ` ` is not registered
Error message
native item `{}` is not registered What it means
Panic raised while building an interpreted component instance: an item element in the .slint file refers to a native item type (e.g. Rectangle, Text, Button) whose factory is not present in the item registry. The interpreter cannot instantiate unknown native widgets.
Solutions
- Verify the element name is a real, registered Slint builtin item (Rectangle, Text, Image, TouchArea, etc.).
- Register missing native items in the item registry before building the instance (custom backends/embedded setups).
- Update i-slint-compiler/runtime crates together so registry and compiler agree on known items.
- Check that the .slint file doesn't shadow or mis-import a component name that resolves to an unknown native type.
Example fix
// before (unregistered custom native item in .slint)
MyNativeWidget {}
// after: use a registered builtin or register the item first
Rectangle { }
// or in Rust: registry.register("MyNativeWidget", factory); Defensive patterns
Strategy: validation
Validate before calling
// Before compiling, check every element type is a known builtin/component // e.g. grep the .slint for element names and confirm each is imported or builtin
Try / catch
// Rust: capture panics if compiling untrusted .slint let result = std::panic::catch_unwind(|| build_instance(...));
Prevention
- Only use documented builtin items unless you registered custom native items.
- Keep compiler, interpreter, and widget-library versions in lockstep.
- Register all custom native items in the item registry at startup.
- Compile .slint files early in CI to surface unregistered items before runtime.
When it happens
Trigger: Compiling/running a .slint file through the interpreter that instantiates a native item type absent from the item registry used to build the instance (build_instance / build_sub_component_instance).
Common situations: A custom/internal widget used without registering its native item; stale or partial registry in an embedded/testing backend; importing a widget library version that defines items not in the interpreter's registry; typos or experimental elements not yet wired into the registry.
Related errors
- Cannot get property
- Cannot invoke callback
- Cannot set callback
- Cannot set property
- Global was just valid
AI-assisted analysis of slint-ui/slint@3a7e700487 (2026-09-16).
Data as JSON: /api/errors/4dbb4e60f295d307.
Report an issue: GitHub.
Appendix: source
Thrown at internal/interpreter/instance.rs:880
parent: Weak<SubComponentInstance>,
) -> Pin<Rc<SubComponentInstance>> {
let sc = &cu.sub_components[sub_idx];
let registry = ItemRegistry::global();
let properties = sc
.properties
.iter()
.map(|p| Rc::pin(Property::new(crate::eval::default_value_for_type(&p.ty))))
.collect();
let callbacks = sc.callbacks.iter().map(|_| Rc::pin(Callback::default())).collect();
let callback_trackers =
sc.callbacks.iter().map(|c| c.needs_tracker.then(|| Rc::pin(Property::new(())))).collect();
let items =
sc.items
.iter()
.map(|item| {
registry.factory(&item.ty.class_name).unwrap_or_else(|| {
panic!("native item `{}` is not registered", item.ty.class_name)
})()
})
.collect();
let repeaters = sc
.repeated
.iter()
.map(|rep| {
if rep.data_prop.is_none() {
RepeaterOrConditional::Conditional(Box::pin(Conditional::default()))
} else {
RepeaterOrConditional::Repeater(Box::pin(Repeater::default()))
}
})
.collect();
// `Rc::new_cyclic` gives nested sub-components a `Weak` to their parent.
// `SubComponentInstance` is `Unpin` (every pinned field lives behind its own
// `Pin<Rc<_>>`), so `Pin::new` on the resulting `Rc` needs no unsafe.View on GitHub (pinned to 3a7e700487)