slint-ui/slint · error

Invalid property type for {}::{}

Error message

Invalid property type for {}::{}

What it means

Error "Invalid property type for {}::{}" thrown in slint-ui/slint.

Source

Thrown at internal/compiler/generator/rust_live_preview.rs:149

            let caller_ident = accessor_names::rust_accessor_ident(name, AccessorKind::Invoker);
            property_and_callback_accessors.push(quote!(
                #[allow(dead_code)]
                pub fn #caller_ident(&self, #(#args_name : #callback_args,)*) -> #return_type {
                    self.0.borrow().invoke(#prop_name, &[#(#args_name.into(),)*])
                        .try_into().unwrap_or_else(|_| panic!("Invalid return type for function {}::{}", #component_name, #prop_name))
                }
            ));
        } else {
            let rust_property_type = rust_primitive_type(&p.ty).unwrap();
            let convert_to_value = convert_to_value_fn(&p.ty);
            let convert_from_value = convert_from_value_fn(&p.ty);

            let getter_ident = accessor_names::rust_accessor_ident(name, AccessorKind::Getter);
            property_and_callback_accessors.push(quote!(
                #[allow(dead_code)]
                pub fn #getter_ident(&self) -> #rust_property_type {
                    #convert_from_value(self.0.borrow().get_property(#prop_name))
                        .unwrap_or_else(|_| panic!("Invalid property type for {}::{}", #component_name, #prop_name))
                }
            ));

            let setter_ident = accessor_names::rust_accessor_ident(name, AccessorKind::Setter);
            if !p.read_only() {
                property_and_callback_accessors.push(quote!(
                    #[allow(dead_code)]
                    pub fn #setter_ident(&self, value: #rust_property_type) {
                        self.0.borrow().set_property(#prop_name, #convert_to_value(value))
                    }
                ));
            } else {
                property_and_callback_accessors.push(quote!(
                    #[allow(dead_code)] fn #setter_ident(&self, _read_only_property : ()) { }
                ));
            }
        }
    }

View on GitHub (pinned to 3fd8f2ec03)

Solutions

  1. Ensure the Rust property type matches the property type declared in the .slint file.
  2. Reload the component after changing property types.

When it happens

Trigger: Thrown at internal/compiler/generator/rust_live_preview.rs:149 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/eb943b644a79e0c6. Report an issue: GitHub.