{"record":{"id":"25ef16a4cf6cf5a4","repo":"langchain-ai/deepagents","slug":"editor-command-resolved-to-no-arguments","errorCode":null,"errorMessage":"Editor command resolved to no arguments","messagePattern":"Editor command resolved to no arguments","errorType":"exception","errorClass":"ExternalEditorError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/editor.py","lineNumber":143,"sourceCode":"        allow_empty: Return an empty or whitespace-only edited result instead of\n            treating it as cancellation.\n        raise_on_error: Re-raise editor launch and file errors instead of treating\n            them as cancellation.\n\n    Returns:\n        The edited text with normalized line endings, or `None` if the editor\n            exited with a non-zero status, returned blank text while `allow_empty`\n            is false, or failed while `raise_on_error` is false.\n\n    Raises:\n        ExternalEditorError: If opening or reading the editor file fails while\n            `raise_on_error` is true.\n    \"\"\"\n    cmd = resolve_editor()\n    if cmd is None:\n        if raise_on_error:\n            msg = \"Editor command resolved to no arguments\"\n            raise ExternalEditorError(msg)\n        return None\n\n    tmp_path: str | None = None\n    try:\n        with tempfile.NamedTemporaryFile(\n            suffix=\".md\",\n            prefix=\"deepagents-edit-\",\n            delete=False,\n            mode=\"w\",\n            encoding=\"utf-8\",\n        ) as tmp:\n            tmp_path = tmp.name\n            tmp.write(current_text)\n\n        full_cmd = _prepare_command(cmd, tmp_path)\n\n        # S603: editor command comes from user's own $EDITOR env var\n        result = subprocess.run(  # noqa: S603","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/editor.py#L125-L161","documentation":"`open_in_editor` resolves the external editor command (settings, `$EDITOR`/`$VISUAL`, or platform defaults) before launching it. If `resolve_editor()` returns None — no editor could be determined — and `raise_on_error` is true, it raises `ExternalEditorError` with this message so interactive callers get a clear failure instead of a silent no-op.","triggerScenarios":"Calling `open_in_editor(raise_on_error=True)` where `resolve_editor()` finds no configured editor: no `$EDITOR`/`$VISUAL` env vars, no editor option in settings, and no platform default available.","commonSituations":"Headless/CI containers or stripped Docker images; Windows boxes without a terminal editor; SSH sessions with minimal environments; users who cleared their editor configuration.","solutions":["Set the `EDITOR` environment variable (e.g. `export EDITOR=vim` or `nano`) before launching the app.","Set the editor option in the app's settings/config file to an executable on PATH.","Verify the configured editor binary exists on PATH (`which $EDITOR`).","Call with `raise_on_error=False` if a silent no-op is acceptable in your context."],"exampleFix":"// before\nEDITOR unset -> ExternalEditorError\n// after\nexport EDITOR=vim\napp  # editor resolution now succeeds","handlingStrategy":"fallback","validationCode":"import os, shutil\n\ndef editor_available() -> bool:\n    editor = os.environ.get(\"EDITOR\") or os.environ.get(\"VISUAL\")\n    return bool(editor) and shutil.which(editor) is not None","typeGuard":null,"tryCatchPattern":"try:\n    result = open_in_editor(text, raise_on_error=True)\nexcept ExternalEditorError:\n    result = fallback_in_app_editor(text)","preventionTips":["Set EDITOR in shell profiles and container images.","Use absolute paths for the editor in app settings.","Document the editor requirement for headless deployments.","Provide an in-app editing fallback in your integration."],"tags":["editor","configuration","environment","missing-editor"],"backgroundTag":"editor-not-configured","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}