{"record":{"id":"4dbb4e60f295d307","repo":"slint-ui/slint","slug":"native-item-is-not-registered","errorCode":null,"errorMessage":"native item `{}` is not registered","messagePattern":"native item `(.+?)` is not registered","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/interpreter/instance.rs","lineNumber":880,"sourceCode":"    parent: Weak<SubComponentInstance>,\n) -> Pin<Rc<SubComponentInstance>> {\n    let sc = &cu.sub_components[sub_idx];\n    let registry = ItemRegistry::global();\n\n    let properties = sc\n        .properties\n        .iter()\n        .map(|p| Rc::pin(Property::new(crate::eval::default_value_for_type(&p.ty))))\n        .collect();\n    let callbacks = sc.callbacks.iter().map(|_| Rc::pin(Callback::default())).collect();\n    let callback_trackers =\n        sc.callbacks.iter().map(|c| c.needs_tracker.then(|| Rc::pin(Property::new(())))).collect();\n    let items =\n        sc.items\n            .iter()\n            .map(|item| {\n                registry.factory(&item.ty.class_name).unwrap_or_else(|| {\n                    panic!(\"native item `{}` is not registered\", item.ty.class_name)\n                })()\n            })\n            .collect();\n    let repeaters = sc\n        .repeated\n        .iter()\n        .map(|rep| {\n            if rep.data_prop.is_none() {\n                RepeaterOrConditional::Conditional(Box::pin(Conditional::default()))\n            } else {\n                RepeaterOrConditional::Repeater(Box::pin(Repeater::default()))\n            }\n        })\n        .collect();\n\n    // `Rc::new_cyclic` gives nested sub-components a `Weak` to their parent.\n    // `SubComponentInstance` is `Unpin` (every pinned field lives behind its own\n    // `Pin<Rc<_>>`), so `Pin::new` on the resulting `Rc` needs no unsafe.","sourceCodeStart":862,"sourceCodeEnd":898,"githubUrl":"https://github.com/slint-ui/slint/blob/3a7e700487dc74d404cad0726378053ab763d4e0/internal/interpreter/instance.rs#L862-L898","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before (unregistered custom native item in .slint)\nMyNativeWidget {}\n// after: use a registered builtin or register the item first\nRectangle { }\n// or in Rust: registry.register(\"MyNativeWidget\", factory);","handlingStrategy":"validation","validationCode":"// Before compiling, check every element type is a known builtin/component\n// e.g. grep the .slint for element names and confirm each is imported or builtin","typeGuard":null,"tryCatchPattern":"// Rust: capture panics if compiling untrusted .slint\nlet result = std::panic::catch_unwind(|| build_instance(...));","preventionTips":["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."],"tags":["interpreter","item-registry","instantiation","panic"],"backgroundTag":"class-not-found","analyzedSha":"3a7e700487dc74d404cad0726378053ab763d4e0","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}