langchain-ai/deepagents · error · ExternalEditorError

Editor command resolved to no arguments

Error message

Editor command resolved to no arguments

What it means

`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.

Source

Thrown at libs/code/deepagents_code/editor.py:143

        allow_empty: Return an empty or whitespace-only edited result instead of
            treating it as cancellation.
        raise_on_error: Re-raise editor launch and file errors instead of treating
            them as cancellation.

    Returns:
        The edited text with normalized line endings, or `None` if the editor
            exited with a non-zero status, returned blank text while `allow_empty`
            is false, or failed while `raise_on_error` is false.

    Raises:
        ExternalEditorError: If opening or reading the editor file fails while
            `raise_on_error` is true.
    """
    cmd = resolve_editor()
    if cmd is None:
        if raise_on_error:
            msg = "Editor command resolved to no arguments"
            raise ExternalEditorError(msg)
        return None

    tmp_path: str | None = None
    try:
        with tempfile.NamedTemporaryFile(
            suffix=".md",
            prefix="deepagents-edit-",
            delete=False,
            mode="w",
            encoding="utf-8",
        ) as tmp:
            tmp_path = tmp.name
            tmp.write(current_text)

        full_cmd = _prepare_command(cmd, tmp_path)

        # S603: editor command comes from user's own $EDITOR env var
        result = subprocess.run(  # noqa: S603

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Set the `EDITOR` environment variable (e.g. `export EDITOR=vim` or `nano`) before launching the app.
  2. Set the editor option in the app's settings/config file to an executable on PATH.
  3. Verify the configured editor binary exists on PATH (`which $EDITOR`).
  4. Call with `raise_on_error=False` if a silent no-op is acceptable in your context.

Example fix

// before
EDITOR unset -> ExternalEditorError
// after
export EDITOR=vim
app  # editor resolution now succeeds
Defensive patterns

Strategy: fallback

Validate before calling

import os, shutil

def editor_available() -> bool:
    editor = os.environ.get("EDITOR") or os.environ.get("VISUAL")
    return bool(editor) and shutil.which(editor) is not None

Try / catch

try:
    result = open_in_editor(text, raise_on_error=True)
except ExternalEditorError:
    result = fallback_in_app_editor(text)

Prevention

When it happens

Trigger: 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.

Common situations: Headless/CI containers or stripped Docker images; Windows boxes without a terminal editor; SSH sessions with minimal environments; users who cleared their editor configuration.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/25ef16a4cf6cf5a4. Report an issue: GitHub.