{"record":{"id":"eb943b644a79e0c6","repo":"slint-ui/slint","slug":"invalid-property-type-for","errorCode":null,"errorMessage":"Invalid property type for {}::{}","messagePattern":"Invalid property type for (.+?)::(.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/compiler/generator/rust_live_preview.rs","lineNumber":317,"sourceCode":"            let caller_ident = accessor_names::rust_accessor_ident(name, AccessorKind::Invoker);\n            property_and_callback_accessors.push(quote!(\n                #[allow(dead_code)]\n                pub fn #caller_ident(&self, #(#args_name : #callback_args,)*) -> #return_type {\n                    self.0.borrow().invoke_global(#global_name, #prop_name, &[#(#args_name.into(),)*])\n                        .try_into().unwrap_or_else(|_| panic!(\"Invalid return type for function {}::{}\", #global_name, #prop_name))\n                }\n            ));\n        } else {\n            let rust_property_type = rust_primitive_type(&p.ty).unwrap();\n            let convert_to_value = convert_to_value_fn(&p.ty);\n            let convert_from_value = convert_from_value_fn(&p.ty);\n\n            let getter_ident = accessor_names::rust_accessor_ident(name, AccessorKind::Getter);\n            property_and_callback_accessors.push(quote!(\n                #[allow(dead_code)]\n                pub fn #getter_ident(&self) -> #rust_property_type {\n                    #convert_from_value(self.0.borrow().get_global_property(#global_name, #prop_name))\n                        .unwrap_or_else(|_| panic!(\"Invalid property type for {}::{}\", #global_name, #prop_name))\n                }\n            ));\n\n            let setter_ident = accessor_names::rust_accessor_ident(name, AccessorKind::Setter);\n            if !p.read_only() {\n                property_and_callback_accessors.push(quote!(\n                    #[allow(dead_code)]\n                    pub fn #setter_ident(&self, value: #rust_property_type) {\n                        self.0.borrow().set_global_property(#global_name, #prop_name, #convert_to_value(value))\n                    }\n                ));\n            } else {\n                property_and_callback_accessors.push(quote!(\n                    #[allow(dead_code)] fn #setter_ident(&self, _read_only_property : ()) { }\n                ));\n            }\n        }\n    }","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/slint-ui/slint/blob/3a7e700487dc74d404cad0726378053ab763d4e0/internal/compiler/generator/rust_live_preview.rs#L299-L335","documentation":"This panic comes from a generated property getter accessor in the Rust live-preview code generator. `get_global_property` returns the property's runtime `Value`, which is then converted with `convert_from_value`; if the Value does not match the property's declared type, the conversion returns Err and the code panics. It signals that the property's runtime value type diverges from its declared type in the generated accessor.","triggerScenarios":"Calling a generated getter (e.g. `get_my_prop()`) for a global property whose value in the interpreter instance is not of the declared type — e.g. after a live-reload changed the property type, or the property was never assigned and its default differs from the accessor's assumed type.","commonSituations":"Hot-reload/live-preview sessions where a global property type was edited while generated Rust bindings remained stale; accessing globals from previewed components whose compiled model differs from the generated code.","solutions":["Regenerate the live-preview Rust accessors so they match the current .slint global property declarations","Verify the global property's declared type in the .slint file matches how the accessor was generated","Initialize the global property to a value of the declared type before reading it"],"exampleFix":"// before (accessor generated for bool while property is now string)\npub fn get_label(&self) -> bool { convert_from_value_bool(self.0.borrow().get_global_property(...)).unwrap_or_else(|_| panic!(\"Invalid property type for {}::{}\", ...)) }\n// after (regenerated accessor matching the current declaration)\npub fn get_label(&self) -> SharedString { convert_from_value_string(self.0.borrow().get_global_property(...)).unwrap_or_else(|_| panic!(\"Invalid property type for {}::{}\", ...)) }","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// panic in generated code; avoid by regenerating accessors when property types change","preventionTips":["Regenerate generated accessor modules whenever .slint global property types change","Initialize globals with values of their declared types before first read","Keep a CI test that instantiates all globals through generated getters"],"tags":["rust","interpreter","type-mismatch","code-generation"],"backgroundTag":"type-mismatch","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"}