{"record":{"id":"5217db8498e7b2c3","repo":"Zackriya-Solutions/meetily","slug":"failed-to-serialize-onboarding-status","errorCode":null,"errorMessage":"Failed to serialize onboarding status: {}","messagePattern":"Failed to serialize onboarding status: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/onboarding.rs","lineNumber":97,"sourceCode":"/// Save onboarding status to store\npub async fn save_onboarding_status<R: Runtime>(\n    app: &AppHandle<R>,\n    status: &OnboardingStatus,\n) -> Result<()> {\n    info!(\"Saving onboarding status: step={}, completed={}\",\n          status.current_step, status.completed);\n\n    // Get or create store\n    let store = app.store(\"onboarding-status.json\")\n        .map_err(|e| anyhow::anyhow!(\"Failed to access onboarding store: {}\", e))?;\n\n    // Update last_updated timestamp\n    let mut status = status.clone();\n    status.last_updated = chrono::Utc::now().to_rfc3339();\n\n    // Serialize status to JSON value\n    let status_value = serde_json::to_value(&status)\n        .map_err(|e| anyhow::anyhow!(\"Failed to serialize onboarding status: {}\", e))?;\n\n    // Save to store\n    store.set(\"status\", status_value);\n\n    // Persist to disk\n    store.save()\n        .map_err(|e| anyhow::anyhow!(\"Failed to save onboarding store to disk: {}\", e))?;\n\n    info!(\"Successfully persisted onboarding status to disk\");\n    Ok(())\n}\n\n/// Reset onboarding status (delete from store)\npub async fn reset_onboarding_status<R: Runtime>(\n    app: &AppHandle<R>,\n) -> Result<()> {\n    info!(\"Resetting onboarding status\");\n","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/onboarding.rs#L79-L115","documentation":"serde_json::to_value(&status) failed while serializing OnboardingStatus before writing it to the store. With #[derive(Serialize)] this almost never fails; the error means some field's Serialize implementation errored - a custom impl, a map with non-string keys, or a type whose serialization can fail at runtime.","triggerScenarios":"A field added to OnboardingStatus whose Serialize impl can return an error (custom trait impls, non-string-keyed maps); changing current_step/last_updated types without updating derives.","commonSituations":"Refactors that introduce custom Serialize impls; persisted types gaining runtime-constrained fields.","solutions":["Keep OnboardingStatus fields derive(Serialize)-only and avoid custom fallible impls","Add a unit test that round-trips OnboardingStatus through serde_json to catch regressions","If a custom impl is required, make it infallible or map the error with field context"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Cheap pre-write check: the status must round-trip before it can be persisted\nfn serializable(status: &OnboardingStatus) -> bool {\n    serde_json::to_value(status).is_ok()\n}","typeGuard":null,"tryCatchPattern":"let status_value = serde_json::to_value(&status)\n    .map_err(|e| anyhow!(\"OnboardingStatus serialization failed: {e} - check recently added fields for custom Serialize impls\"))?;","preventionTips":["Derive Serialize for OnboardingStatus; avoid custom fallible impls","Keep a to_value/from_value round-trip unit test in CI","Avoid non-string map keys in persisted types"],"tags":["serde","serialization","onboarding","json"],"backgroundTag":"serde-serialization-failed","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}