{"record":{"id":"779fe1b78cd8994f","repo":"zed-industries/zed","slug":"action-name-is-required","errorCode":null,"errorMessage":"Action name is required","messagePattern":"Action name is required","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"crates/keymap_editor/src/keymap_editor.rs","lineNumber":2725,"sourceCode":"        if self\n            .error\n            .as_ref()\n            .is_some_and(|old_error| old_error.severity == Severity::Warning && *old_error == error)\n        {\n            false\n        } else {\n            self.error = Some(error);\n            cx.notify();\n            true\n        }\n    }\n\n    fn get_selected_action_name(&self, cx: &App) -> anyhow::Result<&'static str> {\n        if let Some(selector) = self.action_editor.as_ref() {\n            let action_name_str = selector.read(cx).text(cx);\n\n            if action_name_str.is_empty() {\n                anyhow::bail!(\"Action name is required\");\n            }\n\n            self.action_name_to_static\n                .get(&action_name_str)\n                .copied()\n                .ok_or_else(|| anyhow::anyhow!(\"Action '{}' not found\", action_name_str))\n        } else {\n            Ok(self.editing_keybind.action().name)\n        }\n    }\n\n    fn validate_action_arguments(&self, cx: &App) -> anyhow::Result<Option<String>> {\n        let action_name = self.get_selected_action_name(cx)?;\n        let action_arguments = self\n            .action_arguments_editor\n            .as_ref()\n            .map(|arguments_editor| arguments_editor.read(cx).editor.read(cx).text(cx))\n            .filter(|args| !args.is_empty());","sourceCodeStart":2707,"sourceCodeEnd":2743,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/keymap_editor/src/keymap_editor.rs#L2707-L2743","documentation":"The keymap editor's get_selected_action_name reads the action-selector text field; when the user opened the action editor but left the name empty, it bails with this validation error (caught by the caller and stored into self.error, then cx.notify() renders it). It is a form-level required-field check, not a system failure.","triggerScenarios":"Pressing Save/Add on a new keybinding while the action selector is empty (the 'else' branch that would reuse editing_keybind.action().name does not apply because an editor is open with blank text).","commonSituations":"Users typing a keystroke then hitting save before picking an action; clearing the selector to 'unset' the action; automated UI tests submitting the form unvalidated.","solutions":["Select an action from the editor's autocomplete list before saving","Disable the save button while the selector text is empty","Trim whitespace before the emptiness check so ' ' also reads as missing","If editing an existing binding, keep the current action name pre-filled so the field starts non-empty"],"exampleFix":"// before\nlet action_name_str = selector.read(cx).text(cx);\nif action_name_str.is_empty() {\n    anyhow::bail!(\"Action name is required\");\n}\n\n// after (guard in the UI layer)\nlet action_name_str = selector.read(cx).text(cx).trim().to_string();\nlet save_enabled = !action_name_str.is_empty();\n// ... .when(!save_enabled, |el| el.opacity(0.5))","handlingStrategy":"validation","validationCode":"let name = selector.read(cx).text(cx).trim().to_string();\nif name.is_empty() { return Ok(()); } // block save instead of erroring later\nlet static_name = self.action_name_to_static.get(&name).copied()\n    .ok_or_else(|| anyhow::anyhow!(\"Action '{}' not found\", name))?;","typeGuard":null,"tryCatchPattern":"if let Err(error) = self.get_selected_action_name(cx) {\n    self.error = Some(error); // already the pattern: surface in UI, do not propagate\n    cx.notify();\n}","preventionTips":["Disable submit actions while required fields are empty","Trim input before emptiness checks","Map field errors to inline messages near the offending control"],"tags":["zed","keymap","ui","form-validation","editor"],"backgroundTag":"form-validation-required-field","analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}