{"record":{"id":"8eea20ee8b44edfa","repo":"slint-ui/slint","slug":"cannot-set-property-global-name-name-e","errorCode":null,"errorMessage":"Cannot set property {global_name}::{name}: {e}","messagePattern":"Cannot set property (.+?)::(.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/live-preview/live_component.rs","lineNumber":217,"sourceCode":"        self.instance()\n            .invoke(name, args)\n            .unwrap_or_else(|e| panic!(\"Cannot invoke callback {name}: {e}\"))\n    }\n\n    /// Forward to set_callback\n    pub fn set_callback(&self, name: &str, callback: Rc<dyn Fn(&[Value]) -> Value + 'static>) {\n        self.callbacks.borrow_mut().insert(name.into(), callback.clone());\n        self.instance()\n            .set_callback(name, move |args| callback(args))\n            .unwrap_or_else(|e| panic!(\"Cannot set callback {name}: {e}\"));\n    }\n\n    /// forward to set_global_property\n    pub fn set_global_property(&self, global_name: &str, name: &str, value: Value) {\n        self.properties.borrow_mut().insert(format!(\"{global_name}.{name}\"), value.clone());\n        self.instance()\n            .set_global_property(global_name, name, value)\n            .unwrap_or_else(|e| panic!(\"Cannot set property {global_name}::{name}: {e}\"))\n    }\n\n    /// forward to get_global_property\n    pub fn get_global_property(&self, global_name: &str, name: &str) -> Value {\n        self.instance()\n            .get_global_property(global_name, name)\n            .unwrap_or_else(|e| panic!(\"Cannot get property {global_name}::{name}: {e}\"))\n    }\n\n    /// Forward to invoke_global\n    pub fn invoke_global(&self, global_name: &str, name: &str, args: &[Value]) -> Value {\n        self.instance()\n            .invoke_global(global_name, name, args)\n            .unwrap_or_else(|e| panic!(\"Cannot invoke callback {global_name}::{name}: {e}\"))\n    }\n\n    /// Forward to set_global_callback\n    pub fn set_global_callback(","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/slint-ui/slint/blob/3a7e700487dc74d404cad0726378053ab763d4e0/internal/live-preview/live_component.rs#L199-L235","documentation":"LiveComponent::set_global_property panics when the interpreter cannot set the property on the named global singleton. The value is first cached for hot-reload replay; if the interpreter returns an Err (unknown global, unknown property, or type mismatch), the code panics because a failed property set would leave the live preview inconsistent.","triggerScenarios":"set_global_property with a global_name that is not an exported global, a property name not declared in that global, or a Value whose type does not match the declared property type.","commonSituations":"Using `{global}.{prop}` or `{global}::{prop}` style strings instead of separate arguments; global not exported from the .slint file; passing a string where the property is an int/color; stale globals after hot reload.","solutions":["Ensure the global is exported (`export global Foo { ... }`) in the compiled .slint","Check the property exists on that global and the Value type matches the declared property type","Pass global and property as two separate arguments, not a combined dotted string"],"exampleFix":"// before\nlive.set_global_property(\"Styles\", \"primairy-color\", Value::String(\"red\".into())); // typo + wrong type\n// after\nlive.set_global_property(\"Styles\", \"primary-color\", Value::Color(Color::from_rgb_u8(255,0,0)));","handlingStrategy":"validation","validationCode":"fn global_prop_ok(instance: &slint_interpreter::ComponentInstance, g: &str, p: &str, v: &Value) -> bool {\n    instance.definition().globals().iter().any(|g2| g2.name == g)\n        && instance.definition().root_component()\n            .properties().iter()\n            .any(|prop| prop.name == p && prop.ty == v.value_type())\n}","typeGuard":null,"tryCatchPattern":"// panic! is not catchable; validate global/property/type first\nif value.value_type() == expected_type {\n    live.set_global_property(\"Styles\", \"primary-color\", value);\n}","preventionTips":["Keep a typed wrapper per global property instead of raw (name, Value) calls","Export globals explicitly and test global names after each .slint edit","Coerce values with Value::from on the declared Rust type before setting"],"tags":["rust","live-preview","interpreter","panic"],"backgroundTag":"entity-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"}