{"record":{"id":"7c3d58fa11d410bc","repo":"aaif-goose/goose","slug":"empty-editor-command","errorCode":null,"errorMessage":"Empty editor command","messagePattern":"Empty editor command","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose-cli/src/session/editor.rs","lineNumber":164,"sourceCode":"/// whitespace to avoid shlex stripping backslashes from Windows paths like\n/// `C:\\Windows\\System32\\notepad.exe`.\nfn split_editor_command(editor_cmd: &str) -> Result<Vec<String>> {\n    if editor_cmd.contains(['\"', '\\'']) {\n        shlex::split(editor_cmd).ok_or_else(|| {\n            anyhow::anyhow!(\"Invalid editor command: unmatched quotes in '{editor_cmd}'\")\n        })\n    } else {\n        Ok(editor_cmd.split_whitespace().map(String::from).collect())\n    }\n}\n\n/// Launch editor and wait for completion\nfn launch_editor(editor_cmd: &str, file_path: &PathBuf) -> Result<()> {\n    use std::process::Stdio;\n\n    let parts = split_editor_command(editor_cmd)?;\n    if parts.is_empty() {\n        return Err(anyhow::anyhow!(\"Empty editor command\"));\n    }\n\n    let mut cmd = Command::new(&parts[0]);\n    if let Ok(cwd) = std::env::current_dir() {\n        cmd.current_dir(cwd);\n    }\n    if parts.len() > 1 {\n        cmd.args(&parts[1..]);\n    }\n    cmd.arg(file_path)\n        .stdin(Stdio::inherit())\n        .stdout(Stdio::inherit())\n        .stderr(Stdio::inherit());\n\n    let status = cmd.status()?;\n\n    if !status.success() {\n        return Err(anyhow::anyhow!(","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-cli/src/session/editor.rs#L146-L182","documentation":"The configured editor command, after splitting, produced zero tokens — it is empty or contains only whitespace. launch_editor refuses to spawn an empty program. This means the editor setting (GOOSE_EDITOR / editor in config / EDITOR fallback) was never set or was set to a blank value.","triggerScenarios":"Invoking a command that opens $EDITOR (e.g. editing a recipe or message in an interactive goose prompt) when the editor config is \"\" or unset-but-defaulted-to-empty; a config file with `editor = ''`.","commonSituations":"Minimal containers or fresh shells with EDITOR unset; config migrations wiping the editor key; CI/non-login shells lacking profile exports.","solutions":["Set an editor: `goose config set editor vim` or export EDITOR=nano in your shell profile.","Check for and remove an empty editor entry in the goose config file.","Verify with `goose config get editor` before retrying the command."],"exampleFix":"# before\n$ goose recipe edit   # or any editor-opening flow\nError: Empty editor command\n\n# after\n$ goose config set editor vim\n$ goose recipe edit","handlingStrategy":"validation","validationCode":"# ensure an editor is configured before any editor-opening flow\n[ -n \"${GOOSE_EDITOR:-${EDITOR:-}}\" ] || { echo 'set editor: goose config set editor vim'; exit 1; }","typeGuard":"fn editor_configured(cmd: &str) -> bool {\n    cmd.split_whitespace().next().is_some()\n}","tryCatchPattern":"if let Err(e) = launch_editor(&editor_cmd, &file) {\n    if e.to_string() == \"Empty editor command\" {\n        eprintln!(\"configure an editor first: `goose config set editor <cmd>`\");\n    }\n    return Err(e);\n}","preventionTips":["Set EDITOR/GOOSE_EDITOR in your shell profile on every machine you use.","Never save an empty editor value in config.","Smoke-test with `goose config get editor` after config migrations."],"tags":["editor","configuration","env-vars","cli"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}