{"record":{"id":"0a1c056a42ffdf93","repo":"Hmbown/CodeWhale","slug":"failed-to-update-setting-invalid-work-surface-pla","errorCode":null,"errorMessage":"Failed to update setting: invalid work surface placement '{value}'. Expected: top, left, right, or off.","messagePattern":"Failed to update setting: invalid work surface placement '(.+?)'\\. Expected: top, left, right, or off\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/settings.rs","lineNumber":1263,"sourceCode":"                    anyhow::bail!(\n                        \"Failed to update setting: invalid ocean treatment '{value}'. Expected: ombre or flat.\"\n                    );\n                }\n                self.ocean_treatment = normalized;\n            }\n            \"focus_texture\" | \"texture\" => {\n                let normalized = value.trim().to_ascii_lowercase();\n                if !matches!(normalized.as_str(), \"off\" | \"scrim\" | \"grain\") {\n                    anyhow::bail!(\n                        \"Failed to update setting: invalid focus texture '{value}'. Expected: off, scrim, or grain.\"\n                    );\n                }\n                self.focus_texture = normalized;\n            }\n            \"work_surface_placement\" | \"work_surface\" | \"work_rail\" => {\n                let normalized = value.trim().to_ascii_lowercase();\n                if !matches!(normalized.as_str(), \"top\" | \"left\" | \"right\" | \"off\") {\n                    anyhow::bail!(\n                        \"Failed to update setting: invalid work surface placement '{value}'. Expected: top, left, right, or off.\"\n                    );\n                }\n                self.work_surface_placement = normalized;\n            }\n            \"rail_panel\" | \"rail\" => {\n                let normalized = value.trim().to_ascii_lowercase();\n                if !matches!(\n                    normalized.as_str(),\n                    \"tasks\" | \"agents\" | \"context\" | \"pinned\"\n                ) {\n                    anyhow::bail!(\n                        \"Failed to update setting: invalid rail panel '{value}'. Expected: tasks, agents, context, or pinned.\"\n                    );\n                }\n                self.rail_panel = normalized;\n                self.rail_panel_explicit = true;\n            }","sourceCodeStart":1245,"sourceCodeEnd":1281,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/settings.rs#L1245-L1281","documentation":"SettingsStore.update validates work_surface_placement against the allowed set top, left, right, off (after trim + lowercase) (crates/tui/src/settings.rs:1263). Values outside that set are rejected with the expected list in the message and nothing is written.","triggerScenarios":"/set work_rail bottom or settings.update(\"work_surface_placement\", \"bottom\"); config files carrying a placement name from an older layout; code building the value from user free-text or an enum that drifted from the runtime's vocabulary","commonSituations":"Layout options renamed across versions (e.g. a removed 'bottom' placement); users guessing positions; settings sync between different builds.","solutions":["Use one of top, left, right, or off (casing is normalized)","Bind UI controls to the exact allowed strings","Sanitize imported/legacy config by mapping old placement names to supported ones or falling back to the default","Validate settings files at startup after upgrades"],"exampleFix":"// before\nsettings.update(\"work_surface\", \"bottom\")?; // invalid\n\n// after\nsettings.update(\"work_surface\", \"left\")?;  // or \"top\" / \"right\" / \"off\"","handlingStrategy":"type-guard","validationCode":"let v = value.trim().to_ascii_lowercase();\nif !matches!(v.as_str(), \"top\" | \"left\" | \"right\" | \"off\") {\n    return Err(anyhow::anyhow!(\"unsupported work surface placement\"));\n}\nsettings.update(\"work_surface_placement\", &v)?;","typeGuard":"fn is_valid_work_surface_placement(value: &str) -> bool {\n    matches!(value.trim().to_ascii_lowercase().as_str(), \"top\" | \"left\" | \"right\" | \"off\")\n}","tryCatchPattern":"match settings.update(\"work_surface_placement\", value) {\n    Ok(()) => {}\n    Err(err) if err.to_string().contains(\"invalid work surface placement\") => {\n        settings.update(\"work_surface_placement\", \"left\")?; // safe default\n    }\n    Err(err) => return Err(err),\n}","preventionTips":["Bind placement UI to a cycle of exactly top/left/right/off","Centralize allowed-value lists so settings writers and UI share one source of truth","Validate persisted settings after upgrades and remap removed placements to the default","Log rejected values with the allowed list so users can self-correct"],"tags":["rust","settings","validation","tui","configuration"],"backgroundTag":"invalid-settings-value","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}