How to fix error: could not run sequence editor in Git

GitBEGINNERMEDIUMUpdated Dec 2, 2025ยท 108 views

Git cannot launch the configured sequence editor when starting an interactive rebase. This typically occurs when the editor is misconfigured, missing, or incompatible with the terminal environment.

Quick fix

Fixes error: could not run sequence editor

# Check all editor-related configuration
git config --list | grep editor

# Specifically check sequence editor
git config --get sequence.editor

# Check environment variables
echo $GIT_SEQUENCE_EDITOR
echo $GIT_EDITOR
  1. Check which editor Git is trying to use
  2. Remove invalid sequence.editor configuration
  3. Set a working editor
  4. Test your editor configuration
git โ€” error
# Check all editor-related configuration
git config --list | grep editor
# Specifically check sequence editor
git config --get sequence.editor
# Check environment variables
echo $GIT_SEQUENCE_EDITOR
echo $GIT_EDITOR
error: could not run sequence editor

What this error means

This error appears when Git attempts to open a text editor for an interactive rebase (`git rebase -i`) but fails to launch the configured sequence editor. During an interactive rebase, Git needs to open an editor so you can modify the rebase instruction sheet (the git-rebase-todo file). If the editor command is invalid, points to a non-existent program, or cannot be executed in the current environment, Git will abort with this error. Git uses a specific hierarchy to determine which editor to use for interactive rebase operations: first it checks the GIT_SEQUENCE_EDITOR environment variable, then the sequence.editor config setting, then falls back to GIT_EDITOR or core.editor. If any of these point to an invalid editor, the rebase operation will fail immediately. This is different from commit message editing, which uses core.editor. While it's common for both to use the same editor, having them configured differently can lead to confusion and errors when the sequence editor is misconfigured but regular commits work fine.

Typical symptoms

  • Interactive rebase fails immediately with "error: could not run sequence editor"
  • Error message "unable to start editor" or "cannot spawn" followed by an editor name
  • Git rebase -i exits without opening any editor window
  • Regular git commits work fine, but interactive rebases fail
  • IDE-based rebases fail while command-line commits succeed

Common causes

  1. The sequence.editor config points to a non-existent or misspelled program name
  2. An IDE like VS Code set sequence.editor to a tool that is not in your PATH
  3. The GIT_SEQUENCE_EDITOR environment variable contains an invalid value
  4. The configured editor requires additional flags (like --wait) that are missing
  5. Editor path contains spaces and is not properly quoted in the configuration
  6. Windows path separators (backslashes) are not escaped in git config
  7. The editor program is installed but not accessible from the current shell

How to fix "error: could not run sequence editor"

1Check which editor Git is trying to use

First, identify what sequence editor Git is configured to use:

bash
# Check all editor-related configuration
git config --list | grep editor

# Specifically check sequence editor
git config --get sequence.editor

# Check environment variables
echo $GIT_SEQUENCE_EDITOR
echo $GIT_EDITOR

Look for any reference to a program name that doesn't exist on your system, like interactive-rebase-tool, rebase-editor, or an incorrect IDE path.

2Remove invalid sequence.editor configuration

If you found an invalid sequence.editor setting, remove it:

bash
# Remove from global config
git config --global --unset sequence.editor

# Or remove from local repository config
git config --unset sequence.editor

This will cause Git to fall back to your core.editor or GIT_EDITOR setting.

3Set a working editor

Configure a reliable text editor that works in your terminal:

bash
# Use vim (available on most systems)
git config --global core.editor vim

# Use nano (beginner-friendly)
git config --global core.editor nano

# Use VS Code (requires --wait flag)
git config --global core.editor "code --wait"

# Use Sublime Text
git config --global core.editor "subl -n -w"

Important: GUI editors like VS Code and Sublime Text require the --wait or -w flag so Git waits for you to close the file before continuing.

4Test your editor configuration

Verify the editor works before attempting another rebase:

bash
# Test with a commit (uses core.editor)
git commit --allow-empty -m "Test commit"

# Test with interactive rebase on a safe commit
git rebase -i HEAD~1

The editor should open successfully. If it does, type :q (vim) or Ctrl+X (nano) to exit without making changes.

5Abort stuck rebase if necessary

If you were in the middle of a rebase when the error occurred:

bash
# Abort the rebase and return to original state
git rebase --abort

# Or quit the rebase and leave HEAD detached
git rebase --quit

Use --abort to completely undo the rebase. Use --quit if you want to preserve the current state.

Advanced notes

One-time editor override: You can specify an alternative editor for a single rebase command without changing your config:

bash
git -c sequence.editor=vim rebase -i HEAD~3

Environment variable for temporary change:

bash
GIT_SEQUENCE_EDITOR=nano git rebase -i origin/main

Non-interactive rebases: For automated workflows, you can use a no-op editor with autosquash:

bash
GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash origin/main

This sets the editor to the shell's true command, which exits immediately with success.

Windows path issues: On Windows, if your editor path contains spaces or backslashes, ensure it's properly escaped:

bash
git config --global core.editor "'C:/Program Files/editor/editor.exe' --wait"

Difference between core.editor and sequence.editor: While both can be set to different editors, this is generally not recommended. The sequence editor is specifically for editing the rebase instruction sheet, while core.editor is for commit messages. Having them differ can create confusion.

Frequently asked questions

What does "error: could not run sequence editor" mean?
This error appears when Git attempts to open a text editor for an interactive rebase (git rebase -i) but fails to launch the configured sequence editor. During an interactive rebase, Git needs to open an editor so you can modify the rebase instruction sheet (the git-rebase-todo file). If the editor command is invalid, points to a non-existent program, or cannot be executed in the current environment, Git will abort with this error.
How do I fix "error: could not run sequence editor"?
Git cannot launch the configured sequence editor when starting an interactive rebase. This typically occurs when the editor is misconfigured, missing, or incompatible with the terminal environment.
What causes "error: could not run sequence editor"?
The sequence.editor config points to a non-existent or misspelled program name An IDE like VS Code set sequence.editor to a tool that is not in your PATH The GIT_SEQUENCE_EDITOR environment variable contains an invalid value
Is the "error: could not run sequence editor" error serious?
It is a medium-severity error โ€” more of a blocker than a risk. The steps above resolve it.

Official resources & further reading