{"record":{"id":"6c4d2bdbbfa842ca","repo":"flxzt/rnote","slug":"settings-schema-not-found","errorCode":null,"errorMessage":"Settings schema not found.","messagePattern":"Settings schema not found\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/rnote-ui/src/appwindow/appsettings.rs","lineNumber":13,"sourceCode":"// Imports\nuse crate::appwindow::RnAppWindow;\nuse adw::{prelude::*, subclass::prelude::*};\nuse gtk4::{gdk, glib, glib::clone};\nuse tracing::error;\n\nimpl RnAppWindow {\n    /// Setup settings binds.\n    pub(crate) fn setup_settings_binds(&self) -> anyhow::Result<()> {\n        let app = self.app();\n        let app_settings = app\n            .app_settings()\n            .ok_or_else(|| anyhow::anyhow!(\"Settings schema not found.\"))?;\n\n        app.style_manager().connect_color_scheme_notify(clone!(\n            #[weak]\n            app_settings,\n            move |style_manager| {\n                let color_scheme = match style_manager.color_scheme() {\n                    adw::ColorScheme::Default => String::from(\"default\"),\n                    adw::ColorScheme::ForceLight => String::from(\"force-light\"),\n                    adw::ColorScheme::ForceDark => String::from(\"force-dark\"),\n                    _ => String::from(\"default\"),\n                };\n\n                if let Err(e) = app_settings.set_string(\"color-scheme\", &color_scheme) {\n                    error!(\"Failed to set setting `color-scheme`, Err: {e:?}\");\n                }\n            }\n        ));\n","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/flxzt/rnote/blob/bbc5354502ba2fc83eec2670b535348825e679a6/crates/rnote-ui/src/appwindow/appsettings.rs#L1-L31","documentation":"Thrown by RnAppWindow::setup_settings_binds when app.app_settings() returns None, i.e. the GioSettings wrapper for the application's GSettings schema could not be constructed. Without the schema, no settings can be bound and the window setup aborts.","triggerScenarios":"GSettings schema compiled with glib-compile-schemas is missing at runtime — wrong GSETTINGS_SCHEMA_DIR, schema not installed (meson build without install step), or an incorrect schema id when creating the app_settings.","commonSituations":"Running a debug build without `meson compile` install of schemas, flatpak sandbox missing the schema, GSETTINGS_SCHEMA_DIR pointing to the wrong directory, or renaming the schema id without updating code.","solutions":["Compile and install schemas: run glib-compile-schemas on the schemas dir and ensure `meson install`/build installs them","Set GSETTINGS_SCHEMA_DIR to the directory containing the compiled schema when running unbuilt/debug binaries","Verify the schema id in the code matches the id in the .gschema.xml file","Check the flatpak/sandbox manifest includes the schema in its export"],"exampleFix":"// before (shell)\ncargo run\n// after (shell)\nglib-compile-schemas crates/rnote-ui/data/resources  # or the build output dir\nexport GSETTINGS_SCHEMA_DIR=target_dir_with_schemas\ncargo run","handlingStrategy":"try-catch","validationCode":"let schema_dir = std::env::var(\"GSETTINGS_SCHEMA_DIR\").unwrap_or_default();\nassert!(std::path::Path::new(&schema_dir).join(\"gschemas.compiled\").exists(), \"compiled schemas missing in {schema_dir}\");","typeGuard":null,"tryCatchPattern":"let Some(app_settings) = app.app_settings() else {\n    log::error!(\"GSettings schema not found; check GSETTINGS_SCHEMA_DIR and schema installation\");\n    return Ok(()); // degrade gracefully instead of failing window init\n};","preventionTips":["Always run the app with schemas compiled and installed (meson install or glib-compile-schemas)","Set GSETTINGS_SCHEMA_DIR when running debug builds","Keep the schema id in code in sync with the .gschema.xml file","Verify schema export in flatpak manifests"],"tags":["gsettings","schema","configuration"],"backgroundTag":"missing-config-file","analyzedSha":"bbc5354502ba2fc83eec2670b535348825e679a6","analyzedAt":"2026-09-08T13:20:33.747Z","contentChangedAt":"2026-09-08T13:20:33.747Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}