codex - 💡(How to fix) Fix Codex left WezTerm Lua config broken after edit instead of validating available config parser [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19120Fetched 2026-04-24 06:00:32
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×4closed ×1commented ×1

Error Message

runtime error: [string "C:\Users\<user>\.wezterm.lua"]:120: wrong number of arguments to 'insert' stack traceback: [C]: in function 'table.insert' [string "C:\Users\<user>\.wezterm.lua"]:120: in local 'ssh_command' [string "C:\Users\<user>\.wezterm.lua"]:126: in main chunk

Code Example

runtime error: [string "C:\\Users\\<user>\\.wezterm.lua"]:120: wrong number of arguments to 'insert'
stack traceback:
        [C]: in function 'table.insert'
        [string "C:\\Users\\<user>\\.wezterm.lua"]:120: in local 'ssh_command'
        [string "C:\\Users\\<user>\\.wezterm.lua"]:126: in main chunk

---

local function ssh_command(...)
  local args = {}

  for _, value in ipairs(ssh_prefix) do
    table.insert(args, value)
  end

  for i = 1, select('#', ...) do
    local value = select(i, ...)
    table.insert(args, value)
  end

  return args
end

local ssh_target = ssh_command('-t', ssh_host, remote_shell_command)

---

wezterm --config-file C:\Users\<user>\.wezterm.lua show-keys
RAW_BUFFERClick to expand / collapse

What version of Codex is running?

codex-cli 0.114.0

What happened?

During a local Windows config-editing task, Codex modified a WezTerm Lua config and completed the task without running an available validation command. On the next WezTerm startup, the config failed to load with a Lua runtime error:

runtime error: [string "C:\\Users\\<user>\\.wezterm.lua"]:120: wrong number of arguments to 'insert'
stack traceback:
        [C]: in function 'table.insert'
        [string "C:\\Users\\<user>\\.wezterm.lua"]:120: in local 'ssh_command'
        [string "C:\\Users\\<user>\\.wezterm.lua"]:126: in main chunk

The generated helper was assembling SSH command arguments for a WezTerm profile:

local function ssh_command(...)
  local args = {}

  for _, value in ipairs(ssh_prefix) do
    table.insert(args, value)
  end

  for i = 1, select('#', ...) do
    local value = select(i, ...)
    table.insert(args, value)
  end

  return args
end

local ssh_target = ssh_command('-t', ssh_host, remote_shell_command)

A follow-up fix replaced the varargs/table.insert path with explicit list input and args[#args + 1] = value, then validated successfully with:

wezterm --config-file C:\Users\<user>\.wezterm.lua show-keys

Expected behavior

For known application config edits, especially where a fast local parser/validation command is available, Codex should run that validation before completing the task or otherwise surface the risk. In this case, wezterm show-keys would have caught the startup-breaking config immediately.

Actual behavior

Codex left a startup-breaking WezTerm config in place and reported the task as done. The user only discovered the failure by launching WezTerm afterward.

Environment

  • OS: Windows / PowerShell
  • Codex CLI: 0.114.0
  • WezTerm: 20240203-110809-5046fc22

Hostnames, usernames, and private IPs have been redacted from this report.

extent analysis

TL;DR

Run a validation command, such as wezterm --config-file C:\Users\<user>\.wezterm.lua show-keys, after editing WezTerm config files to catch potential errors before they cause issues.

Guidance

  • Review the Codex configuration to see if there's an option to automatically run validation commands after editing specific config files, such as WezTerm's Lua config.
  • Consider adding a custom validation step to the Codex task to ensure that the generated config is valid before completing the task.
  • Verify that the ssh_command function is correctly handling the arguments and not causing the Lua runtime error.
  • Check the WezTerm documentation to see if there are any specific requirements or restrictions for the ssh_command function.

Example

No code example is provided as the issue is more related to the workflow and validation process rather than a specific code fix.

Notes

The issue seems to be related to the lack of validation after editing the WezTerm config file. Running a validation command after editing the config file can help catch potential errors before they cause issues.

Recommendation

Apply a workaround by adding a custom validation step to the Codex task to run wezterm --config-file C:\Users\<user>\.wezterm.lua show-keys after editing the WezTerm config file. This will help ensure that the generated config is valid before completing the task.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

For known application config edits, especially where a fast local parser/validation command is available, Codex should run that validation before completing the task or otherwise surface the risk. In this case, wezterm show-keys would have caught the startup-breaking config immediately.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Codex left WezTerm Lua config broken after edit instead of validating available config parser [1 comments, 2 participants]