/terminal-setup uses invalid TOML escape sequence \x1b for Alacritty config

Status Fixed / completed
Reported on v2.0.74
Maintainer reply ✓ Yes — cg505
Activity 9 comments · opened Dec 19, 2025 · closed Apr 18, 2026
💡 Likely answer: A maintainer (cg505, contributor) responded on this thread — see the highlighted reply below.

Bug Description

The /terminal-setup command writes an invalid escape sequence to the Alacritty TOML config file, causing Alacritty to fail to load the configuration.

Steps to Reproduce

  1. Run /terminal-setup in Claude Code
  2. Select Alacritty as the terminal
  3. Alacritty shows a config parse error

Error Message

[ERROR] Unable to load config "/Users/username/.config/alacritty/alacritty.toml": Config error: TOML parse error at line 28, column 11
28 | chars = "\x1b\r"
   |           ^
missing escaped value, expected 'b', 'f', 'n', 'r', '\', '"', 'u', 'U'

Root Cause

The generated config uses \x1b (hex escape) which is not valid in TOML. TOML only supports these escape sequences:

  • \b, \f, \n, \r, \t, \\, \"
  • \uXXXX (4-digit Unicode)
  • \UXXXXXXXX (8-digit Unicode)

Fix

Replace \x1b with \^[ in the generated Alacritty config:

# Wrong (current)
chars = "\x1b\r"

# Correct (should be)
chars = "\^[\r"

Environment

  • Claude Code version: 2.0.74
  • OS: macOS
  • Terminal: Alacritty

View original on GitHub ↗

9 Comments

Kryticyz · 8 months ago

I experienced this error and this fix worked for me

DadiiLon · 8 months ago

Workaround Confirmed Working on Linux + Alacritty

I can confirm this workaround resolves the Shift+Enter issue for Alacritty on Linux.

Environment

  • OS: Arch Linux (kernel 6.17.8-arch1-1)
  • Terminal: Alacritty 0.16.1
  • Claude Code: 2.0.76
  • Window Manager: Hyprland

Solution

Add this to your ~/.config/alacritty/alacritty.toml:

[[keyboard.bindings]]
key = "Return"
mods = "Shift"
chars = "\n"

This uses valid TOML syntax (\n for newline) instead of the invalid \x1b hex escape that /terminal-setup tries to generate.

Steps

  1. Open ~/.config/alacritty/alacritty.toml in your editor
  2. Add the keybinding above (usually in the [[keyboard.bindings]] section)
  3. Save and restart Alacritty
  4. Shift+Enter now creates a new line in Claude Code instead of sending the message

Tested and working - Shift+Enter now properly inserts newlines without breaking the TOML config.

DanOpcode · 7 months ago

Thanks, experienced the same bug and this worked for me too!

andiradulescu · 7 months ago

On Omarchy keyboard bindings are already defined like this:

[keyboard]
bindings = [
{ key = "Insert", mods = "Shift", action = "Paste" },
{ key = "Insert", mods = "Control", action = "Copy" }
]

So it needs:

[keyboard]
bindings = [
{ key = "Insert", mods = "Shift", action = "Paste" },
{ key = "Insert", mods = "Control", action = "Copy" },
{ key = "Return", mods = "Shift", chars = "\^[\r" }
]
cg505 contributor · 7 months ago

Slightly hijacking this to also suggest including mode = "~Search" in the binding to retain the "jump to previous match" behavior in search mode.

pvinis · 7 months ago

Confirming this issue on Linux (CachyOS/Arch) with Alacritty. The fix works for me too.

yurukusa · 5 months ago

The fix is straightforward — TOML requires \^[ (Unicode escape) instead of \x1b (hex escape).
Manual fix for your Alacritty config:
Replace:

chars = "\x1b\r"

With:

chars = "\^[\r"

\^[ is the TOML-valid Unicode escape for ESC (U+001B). This is equivalent to \x1b but uses the escape format TOML actually supports.
If /terminal-setup overwrites your fix:
You can protect the corrected config with a PostToolUse hook that auto-patches after any Bash operation:

// ~/.claude/settings.json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Bash",
        "hook": "bash -c 'FILE=~/.config/alacritty/alacritty.toml; [ -f \"\\" ] && sed -i \"s/\\\\x1b/\\\\^[/g\" \"\\" || true'"
      }
    ]
  }
}

This silently corrects any \x1b\^[ in your Alacritty config after tool operations.

ashwin-ant collaborator · 4 months ago

This was fixed in v2.1.45 — /terminal-setup now writes a TOML-valid \^[ escape to the Alacritty config instead of the invalid \x1b. If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.