{"record":{"id":"8969d1ff296eb93b","repo":"xai-org/grok-build","slug":"invalid-editor-command","errorCode":null,"errorMessage":"invalid editor command","messagePattern":"invalid editor command","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-pager/src/app/event_loop.rs","lineNumber":718,"sourceCode":"    if !suspend_retry_ready(*suspend_retry_after, Instant::now()) {\n        return Ok(());\n    }\n    // The gate is consumed before any blocking park/drain attempt\n    // A timeout must arm a fresh deadline before this function returns\n    if !editor_pending && !pager_pending {\n        *suspend_retry_after = None;\n        return Ok(());\n    }\n    *suspend_retry_after = None;\n\n    // $EDITOR suspend: disable raw mode, spawn the editor, wait for exit, then restore\n    // Preparation writes prompt drafts out only immediately before this safe terminal handoff\n    if let Some(request) = app.pending_editor.take() {\n        let retry_request = request.clone();\n        match crate::app::external_editor::prepare(app, request) {\n            Ok(Some(prepared)) => {\n                let launch = prepared.launch();\n                let mut editor_result = Err(std::io::Error::new(\n                    std::io::ErrorKind::InvalidInput,\n                    \"invalid editor command\",\n                ));\n                let moved_cursor = match suspend_for_child(\n                    app.screen_mode,\n                    terminal,\n                    input_paused,\n                    reader_parked,\n                    input_rx,\n                    || {\n                        editor_result = std::process::Command::new(&launch.argv[0])\n                            .args(&launch.argv[1..])\n                            .arg(&launch.path)\n                            .status();\n                    },\n                ) {\n                    Ok(moved_cursor) => moved_cursor,\n                    Err(error) if error.kind() == std::io::ErrorKind::TimedOut => {","sourceCodeStart":700,"sourceCodeEnd":736,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/app/event_loop.rs#L700-L736","documentation":"A placeholder io::Error (InvalidInput, 'invalid editor command') used as the initial editor_result in run_pending_suspends when preparing the pending external editor request. It is the sentinel value that remains only if the editor launch never assigns a real result; preparation failures surface through external_editor::prepare instead.","triggerScenarios":"Only reachable if the editor_result sentinel is never overwritten — i.e. an internal logic path where prepared.launch() / suspend_for_child fails to produce a result, or external_editor::prepare yields a launch config with an empty/invalid command.","commonSituations":"EDITOR/viual editor config resolving to an empty string or nonexistent binary so prepare/launch cannot form a valid command; internal fallthrough bug.","solutions":["Check that the configured editor command is a non-empty, executable path (EDITOR env or config)","Inspect why prepare() returned Ok(Some) with an unusable launch command","Update the crate if this is a fallthrough bug (sentinel should never leak to the user)","Set a valid editor and retry the editor-open action"],"exampleFix":"// before\nEDITOR=\"\"\n// after\nexport EDITOR=\"vim\"  # or full path: /usr/bin/vim","handlingStrategy":"validation","validationCode":"let editor = std::env::var(\"EDITOR\").unwrap_or_default();\nif editor.trim().is_empty()\n    || which::which(&editor).is_err() {\n    panic!(\"EDITOR must be a non-empty, executable command\");\n}","typeGuard":null,"tryCatchPattern":"match result {\n  Err(e) if e.kind() == std::io::ErrorKind::InvalidInput\n      && e.to_string().contains(\"invalid editor command\") => eprintln!(\"fix EDITOR config\"),\n  ok => ok,\n}","preventionTips":["Set EDITOR (or the config field) to a non-empty, absolute executable path","Verify the editor binary exists with `command -v $EDITOR`","Report to maintainers if this sentinel error ever surfaces — it should be internal only"],"tags":["editor","terminal","config","io"],"backgroundTag":"invalid-editor-command","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}