{"record":{"id":"0b386cfc08cae99f","repo":"zed-industries/zed","slug":"unregistered-setting-type","errorCode":null,"errorMessage":"unregistered setting type {}","messagePattern":"unregistered setting type (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/settings/src/settings_store.rs","lineNumber":449,"sourceCode":"        }\n\n        let setting_value = entry.or_insert((registered_setting.settings_value)());\n        let value = (registered_setting.from_settings)(&self.merged_settings);\n        setting_value.set_global_value(value);\n    }\n\n    pub fn merged_settings(&self) -> &SettingsContent {\n        &self.merged_settings\n    }\n\n    /// Get the value of a setting.\n    ///\n    /// Panics if the given setting type has not been registered, or if there is no\n    /// value for this setting.\n    pub fn get<T: Settings>(&self, path: Option<SettingsLocation>) -> &T {\n        self.setting_values\n            .get(&TypeId::of::<T>())\n            .unwrap_or_else(|| panic!(\"unregistered setting type {}\", type_name::<T>()))\n            .value_for_path(path)\n            .downcast_ref::<T>()\n            .expect(\"no default value for setting type\")\n    }\n\n    /// Get the value of a setting.\n    ///\n    /// Does not panic\n    pub fn try_get<T: Settings>(&self, path: Option<SettingsLocation>) -> Option<&T> {\n        self.setting_values\n            .get(&TypeId::of::<T>())\n            .map(|value| value.value_for_path(path))\n            .and_then(|value| value.downcast_ref::<T>())\n    }\n\n    /// Get all values from project specific settings\n    pub fn get_all_locals<T: Settings>(&self) -> Vec<(WorktreeId, Arc<RelPath>, &T)> {\n        self.setting_values","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/settings/src/settings_store.rs#L431-L467","documentation":"Zed's SettingsStore keeps setting values keyed by TypeId; entries appear only when a settings type is registered via SettingsStore::register_setting::<T>() (crates/settings/src/settings_store.rs:407), normally reached through T::register(cx) during app or test init. get::<T>() (crates/settings/src/settings_store.rs:449) unwraps that lookup and panics, printing the concrete Rust type name of the missing setting. That type name is the fastest clue to which init step was skipped.","triggerScenarios":"Reading a setting whose registration never ran: SettingsStore::get(None or Some(location)) as T, or typed helpers like T::get_global(cx)/T::get(...) that route through it, in a process where T::register(cx) / register_setting::<T>() was not called first.","commonSituations":"GPUI unit tests reading a setting without the standard settings fixture in build_app; a new crate reading another crate's setting before that crate's init ran; entry points that skip the normal app init sequence; refactors moving register calls out of startup.","solutions":["Register the setting before any read: call MySettings::register(cx) in app startup, or set the store up in tests (SettingsStore::new(cx, ...) plus register_setting) before reading.","Take the type name from the panic message, locate its Settings impl, and verify the path that calls its register actually executed.","If the read may legitimately precede registration, use SettingsStore::try_get::<T>() (crates/settings/src/settings_store.rs:458) which returns Option instead of panicking.","In tests, reuse the established settings fixture rather than ad-hoc reads."],"exampleFix":"// before (test or early startup)\nlet value = MySettings::get_global(cx); // panics: unregistered setting type\n\n// after\nMySettings::register(cx);\nlet value = MySettings::get_global(cx);","handlingStrategy":"validation","validationCode":"// startup / test setup: register before any read\nMySettings::register(cx); // wraps SettingsStore::register_setting::<MySettings>()\n\n// reads that may run before init completes:\nif let Some(value) = SettingsStore::global(cx).read(cx).try_get::<MySettings>(None) {\n    // use value\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give every Settings impl a register call in one startup list; keep the list complete.","Use try_get in code that can run before initialization.","Make test fixtures initialize the settings store the same way the app does.","Read the panic's type name — it names exactly which registration is missing."],"tags":["settings","registration","startup","panic","gpui-tests","zed"],"backgroundTag":"unregistered-setting-type","analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}