[Bug] WezTerm Config: Invalid Lua Table Syntax in Key Bindings

Status Closed — not planned
Maintainer reply None cached
Activity 5 comments · opened Sep 19, 2025 · closed Feb 6, 2026

Bug Description
using /terminal-setup in wezterm creates syntax errors, and corrupts wezterm.lua, after I fix the syntax errors, shift-enter still doesn't work.

error converting Lua table to Config (lua_value_to_dynamic: error converting
Lua table to value (while processing "keys": error converting Lua string to
numeric array index (Unexpected key "key" for array style table)))
stack traceback:
        [C]: in metamethod 'newindex'
        [string "/Users/bdmorin/.wezterm.lua"]:51: in main chunk

Here's my (broken) wezterm.lua that was running prior to /terminal-setup

-- Minimal WezTerm Configuration
local wezterm = require('wezterm')
local config = wezterm.config_builder()

-- Font
config.font_size = 18
config.font = wezterm.font_with_fallback({
  'ComicShannsMono Nerd Font',
  'JetBrains Mono',
})

-- Theme (easy to change!)
config.color_scheme = "Catppuccin Mocha"
-- Other good themes to try:
-- config.color_scheme = "Tokyo Night"
-- config.color_scheme = "Dracula"
-- config.color_scheme = "Nord"
-- config.color_scheme = "Gruvbox Dark"

-- Window
config.window_background_opacity = 0.9
config.window_decorations = "RESIZE"
config.window_padding = {
  left = 25,
  right = 0,
  top = 0,
  bottom = 0,
}

-- Tab Bar (hidden but tabs still work)
config.hide_tab_bar_if_only_one_tab = true
config.enable_tab_bar = false

-- Performance
config.front_end = "WebGpu"

-- Simple key bindings
local act = wezterm.action
config.keys = {-- Tab navigation
  { key = 't', mods = 'CTRL|SHIFT', action = act.ShowTabNavigator,
  {key="Enter", mods="SHIFT", action=wezterm.action{SendString="\x1b\r"}},},
  { key = 'Tab', mods = 'CTRL', action = act.ActivateTabRelative(1) },
  { key = 'Tab', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(-1) },

  -- Quick tab access
  { key = '1', mods = 'CMD', action = act.ActivateTab(0) },
  { key = '2', mods = 'CMD', action = act.ActivateTab(1) },
  { key = '3', mods = 'CMD', action = act.ActivateTab(2) },
  { key = '4', mods = 'CMD', action = act.ActivateTab(3) },
  { key = '5', mods = 'CMD', action = act.ActivateTab(4) },
}

-- Simple hyperlink detection (no fancy stuff that breaks)
-- config.hyperlink_rules = wezterm.default_hyperlink_rules()


return config

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 1.0.119
  • Feedback ID: 23aacb8a-9615-4426-8eb2-cc17da8c1de5

Errors

[{"error":"Error: Agent file /Users/bdmorin/.claude/agents/claude-agent-analytics-v3.md is missing required 'name' in frontmatter\n    at CB5 (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2370:9300)\n    at file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2370:7749\n    at Array.map (<anonymous>)\n    at file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2370:7679\n    at async Promise.all (index 1)\n    at async W_0.<anonymous> (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:3704:1318)\n    at async W_0.parseAsync (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:704:4184)\n    at async rr5 (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:3735:1293)\n    at async nr5 (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:3694:1151)","timestamp":"2025-09-19T17:44:21.505Z"},{"error":"Error: Missing required \"name\" field in frontmatter\n    at file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2370:7863\n    at Array.map (<anonymous>)\n    at file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2370:7679\n    at async Promise.all (index 1)\n    at async W_0.<anonymous> (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:3704:1318)\n    at async W_0.parseAsync (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:704:4184)\n    at async rr5 (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:3735:1293)\n    at async nr5 (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:3694:1151)","timestamp":"2025-09-19T17:44:21.508Z"},{"error":"Error: Tool mcp__acp__Bash not found\n    at mCB (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:3032:4391)\n    at QC (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_module

Note: Error logs were truncated.

  Lines 39-41 have malformed table entries:

  config.keys = {-- Tab navigation
    { key = 't', mods = 'CTRL|SHIFT', action = act.ShowTabNavigator,
    {key="Enter", mods="SHIFT", action=wezterm.action{SendString="\x1b\r"}},},

  Problems:
  1. Line 39: Missing space after { and before comment
  2. Line 40: Missing closing } for the first table entry
  3. Line 41: Nested table entry incorrectly placed inside line 40's entry
  4. Line 41: Incorrect action syntax wezterm.action{SendString="\x1b\r"} should be act.SendString("\x1b\r")
  5. Line 40-41: Two closing braces },} at end of line 41

Claude is able to self-correct this.

⏺ --- before
  +++ after
  @@ -37,15 +37,18 @@
   -- Simple key bindings
   local act = wezterm.action
  -config.keys = {-- Tab navigation
  -  { key = 't', mods = 'CTRL|SHIFT', action = act.ShowTabNavigator,
  -  {key="Enter", mods="SHIFT", action=wezterm.action{SendString="\x1b\r"}},},
  +config.keys = {
  +  -- Shift+Enter for Claude Code
  +  { key = 'Enter', mods = 'SHIFT', action = act.SendString('\x1b\r') },
  +
  +  -- Tab navigation
  +  { key = 't', mods = 'CTRL|SHIFT', action = act.ShowTabNavigator },
     { key = 'Tab', mods = 'CTRL', action = act.ActivateTabRelative(1) },
     { key = 'Tab', mods = 'CTRL|SHIFT', action = act.ActivateTabRelative(-1) },

     -- Quick tab access
     { key = '1', mods = 'CMD', action = act.ActivateTab(0) },
     { key = '2', mods = 'CMD', action = act.ActivateTab(1) },
     { key = '3', mods = 'CMD', action = act.ActivateTab(2) },
     { key = '4', mods = 'CMD', action = act.ActivateTab(3) },
     { key = '5', mods = 'CMD', action = act.ActivateTab(4) },
   }

  The fix:
  1. Properly separated each key binding entry
  2. Fixed the Shift+Enter action syntax from wezterm.action{SendString="\x1b\r"} to act.SendString('\x1b\r')
  3. Added clear comments for each section
  4. Fixed the malformed table structure

View original on GitHub ↗

5 Comments

github-actions[bot] · 10 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

jonathancostin · 10 months ago

This has occurred to me as well.

hfnhf · 9 months ago

`` at async nr5 (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:3694:1151)","timestamp":"2025-09-19T17:44:21.508Z"},{"error":"Error: Tool mcp__acp__Bash not found\n at mCB (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:3032:4391)\n at QC (file:///Users/bdmorin/.local/share/mise/installs/node/22.19.0/lib/node_module``

"mcp__acp__Bash" is showing up in the errors, that is part of Anthropic's claude-code-mcp interface to do anything via bash. (I do not know what platform you are on but I'm on Microsoft Windows and but somehow "mcp__acp__Bash" translates bash commands to powershell , as well as arranging certain bash root paths to my Windows user directory on my machine).

My hypothesis is part of the issue is not lua or wezterm specific: it looks like
1) claude-code failing at doing something basic by not finding its own internal Tool mcp__acp__Bash
2) possibly getting your edit done via other means, and doing it poorly

github-actions[bot] · 8 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] · 8 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.