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

Resolved 💬 5 comments Opened Sep 19, 2025 by bdmorin 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 ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗