{"record":{"id":"d612c2ff860ce7ab","repo":"jlcodes99/cockpit-tools","slug":"startupperf-updatercommand-get-update-settings","errorCode":null,"errorMessage":"[StartupPerf][UpdaterCommand] get_update_settings failed in {}ms: {}","messagePattern":"\\[StartupPerf\\]\\[UpdaterCommand\\] get_update_settings failed in (.+?)ms: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src-tauri/src/commands/update.rs","lineNumber":49,"sourceCode":"        )),\n    }\n    result\n}\n\n/// Get update settings\n#[tauri::command]\npub fn get_update_settings() -> Result<UpdateSettings, String> {\n    let started = Instant::now();\n    let result = update_checker::load_update_settings();\n    match &result {\n        Ok(settings) => logger::log_info(&format!(\n            \"[StartupPerf][UpdaterCommand] get_update_settings completed in {}ms: auto_check={}, auto_install={}, last_check_time={}\",\n            started.elapsed().as_millis(),\n            settings.auto_check,\n            settings.auto_install,\n            settings.last_check_time\n        )),\n        Err(err) => logger::log_error(&format!(\n            \"[StartupPerf][UpdaterCommand] get_update_settings failed in {}ms: {}\",\n            started.elapsed().as_millis(),\n            err\n        )),\n    }\n    result\n}\n\n/// Patch only the updater fields changed by the caller.\n#[tauri::command]\npub fn patch_update_settings(\n    auto_check: Option<bool>,\n    check_interval_hours: Option<u64>,\n    auto_install: Option<bool>,\n    last_run_version: Option<String>,\n    remind_on_update: Option<bool>,\n    skipped_version: Option<String>,\n) -> Result<UpdateSettings, String> {","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/src-tauri/src/commands/update.rs#L31-L67","documentation":"The get_update_settings command reads auto-update settings (auto_check, auto_install, last_check_time) via update_checker; on Err it logs '[StartupPerf][UpdaterCommand] get_update_settings failed in {ms}ms: {err}' and returns the error. It means the update settings could not be loaded.","triggerScenarios":"update_checker::get_update_settings returns Err: settings file missing/unreadable, JSON deserialization failure (schema changed between app versions), or file lock held by another instance.","commonSituations":"Upgrading the app after the settings schema changed, leaving incompatible JSON; config dir permissions changed; first run with partially initialized settings store.","solutions":["Read the inner err: deserialization errors indicate schema mismatch, I/O errors indicate file access problems.","If the settings JSON is from an older schema, delete/reset it so defaults are regenerated.","Check file permissions and close other app instances locking the settings file.","Retry the command; on transient lock errors a second startup usually succeeds."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const raw = await readSettingsFileRaw().catch(() => null);\nif (raw && !isValidSettingsJson(raw)) await invoke('reset_update_settings');","typeGuard":"function areUpdateSettings(s: unknown): s is { auto_check: boolean; auto_install: boolean; last_check_time: number | null } {\n  const o = s as any;\n  return typeof o === 'object' && o !== null && typeof o.auto_check === 'boolean' && typeof o.auto_install === 'boolean';\n}","tryCatchPattern":"try {\n  const settings = await invoke('get_update_settings');\n} catch (e) {\n  const settings = DEFAULT_UPDATE_SETTINGS; // fallback defaults\n  await invoke('reset_update_settings');\n}","preventionTips":["Migrate settings schema explicitly on app upgrades","Provide sane defaults when the settings file is missing","Validate settings JSON on load and self-heal by resetting","Avoid concurrent first-run writes to the settings file"],"tags":["updater","settings","deserialization","tauri"],"backgroundTag":"settings-load-failed","analyzedSha":"1ed8b77992d62ca81fabf744deb0839ad361d5bf","analyzedAt":"2026-09-05T09:51:41.178Z","contentChangedAt":"2026-09-05T09:51:41.178Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}