How to fix error: could not run sequence editor in Git
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- Check which editor Git is trying to use
- Remove invalid sequence.editor configuration
- Set a working editor
- Test your editor configuration
# Check all editor-related configurationgit config --list | grep editor# Specifically check sequence editorgit config --get sequence.editor# Check environment variablesecho $GIT_SEQUENCE_EDITORecho $GIT_EDITORerror: 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
- 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
- The configured editor requires additional flags (like --wait) that are missing
- Editor path contains spaces and is not properly quoted in the configuration
- Windows path separators (backslashes) are not escaped in git config
- The editor program is installed but not accessible from the current shell
How to fix "error: could not run sequence editor"
First, identify what sequence editor Git is configured to use:
# 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_EDITORLook 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.
If you found an invalid sequence.editor setting, remove it:
# Remove from global config
git config --global --unset sequence.editor
# Or remove from local repository config
git config --unset sequence.editorThis will cause Git to fall back to your core.editor or GIT_EDITOR setting.
Configure a reliable text editor that works in your terminal:
# 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.
Verify the editor works before attempting another rebase:
# 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~1The editor should open successfully. If it does, type :q (vim) or Ctrl+X (nano) to exit without making changes.
If you were in the middle of a rebase when the error occurred:
# Abort the rebase and return to original state
git rebase --abort
# Or quit the rebase and leave HEAD detached
git rebase --quitUse --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:
git -c sequence.editor=vim rebase -i HEAD~3Environment variable for temporary change:
GIT_SEQUENCE_EDITOR=nano git rebase -i origin/mainNon-interactive rebases: For automated workflows, you can use a no-op editor with autosquash:
GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash origin/mainThis 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:
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
- ๐Git Official Documentation
- ๐Git: Interactive Rebase(Official Docs)
- ๐ฌStack Overflow: Git Rebase(Stack Overflow)