{"record":{"id":"ccca912c0ea85598","repo":"slint-ui/slint","slug":"cannot-set-property-name-e","errorCode":null,"errorMessage":"Cannot set property {name}: {e}","messagePattern":"Cannot set property (.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/live-preview/live_component.rs","lineNumber":140,"sourceCode":"            unreachable!(\"Compiler returned Pending\")\n        };\n        Watcher::update_watched_paths(\n            &self.watcher,\n            std::iter::once(self.file_name.clone())\n                .chain(result.watch_paths(i_slint_core::InternalToken).iter().cloned())\n                .chain(self.extra_watch_paths.iter().cloned()),\n        );\n        result\n    }\n\n    /// Reload the properties and callbacks after a reload()\n    pub fn reload_properties_and_callbacks(&self) {\n        // Set the properties\n        for (name, value) in self.properties.borrow_mut().iter() {\n            if let Some((global, prop)) = name.split_once('.') {\n                self.instance()\n                    .set_global_property(global, prop, value.clone())\n                    .unwrap_or_else(|e| panic!(\"Cannot set property {name}: {e}\"));\n            } else {\n                self.instance()\n                    .set_property(name, value.clone())\n                    .unwrap_or_else(|e| panic!(\"Cannot set property {name}: {e}\"));\n            }\n        }\n        for (name, callback) in self.callbacks.borrow_mut().iter() {\n            let callback = callback.clone();\n            if let Some((global, prop)) = name.split_once('.') {\n                self.instance()\n                    .set_global_callback(global, prop, move |args| callback(args))\n                    .unwrap_or_else(|e| panic!(\"Cannot set callback {name}: {e}\"));\n            } else {\n                self.instance()\n                    .set_callback(name, move |args| callback(args))\n                    .unwrap_or_else(|e| panic!(\"Cannot set callback {name}: {e}\"));\n            }\n        }","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/slint-ui/slint/blob/3a7e700487dc74d404cad0726378053ab763d4e0/internal/live-preview/live_component.rs#L122-L158","documentation":"Panic in live-preview's reload_properties_and_callbacks when set_global_property fails after a hot reload. The stored (name, value) pair could not be re-applied to the freshly reloaded component instance.","triggerScenarios":"Live-preview reload where a previously set global property (name contains a '.') no longer exists or its type changed in the reloaded .slint source.","commonSituations":"Editing a .slint file during development: renaming a global, changing a global property's type, deleting a global, or changing the property's type from string to int while live preview keeps old values.","solutions":["Re-declare the global property with the same name and type as before the reload, or clear the stale stored value.","Check the error detail {e} for the exact missing/mismatched property name and fix the .slint source.","Restart the live preview session to drop stale property state.","Keep global property names and types stable across incremental edits."],"exampleFix":"// before (global renamed in .slint)\nexport global Settings { property<int> theme; }\n// after: keep the old name or update the previewer state\nexport global Settings { property<int> color-scheme; } // update all set_global_property(\"Settings\", \"theme\") call sites to \"color-scheme\"","handlingStrategy":"fallback","validationCode":"// Before re-applying after reload, verify the global property still exists\n// if instance.definition().globals().contains(global) && exists prop { set_global_property(...) }","typeGuard":null,"tryCatchPattern":"// Use the raw instance API for graceful handling\nif let Err(e) = instance.set_global_property(global, prop, value) {\n    eprintln!(\"skipping stale global {global}.{prop}: {e}\");\n}","preventionTips":["Keep global names/types stable during a live-preview session.","Clear remembered preview state after breaking edits.","Apply set_global_property via a Result-returning wrapper rather than panicking."],"tags":["live-preview","hot-reload","global-property","panic"],"backgroundTag":"invalid-state-transition","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"}