Session resume can fail: invalid function_call.name like 'functions.exec_command'

Open 💬 1 comment Opened Feb 3, 2026 by mekhanme

Summary

Codex CLI sometimes stores tool/function calls with name values that include a dot, e.g. functions.exec_command. When resuming/continuing a session, OpenAI rejects these names because tool/function name must match ^[a-zA-Z0-9_-]+$, causing:

Invalid 'input[N].name': string does not match pattern '^[a-zA-Z0-9_-]+$'

Impact

Session resume/continuation fails; users have to manually repair ~/.codex/sessions/**/*.jsonl to unblock.

Observed examples

In ~/.codex/sessions/**.jsonl (JSONL session logs), payload.type == "function_call" and:

  • payload.name = "functions.exec_command"
  • payload.name = "functions.mcp__filesystem__read_text_file"
  • payload.name = "functions.mcp__task-hub__create_task"

These are invalid per the regex because of the ..

Reproduction (high-level)

  1. Use Codex CLI normally with tool calls.
  2. Later, try to resume/continue a prior session.
  3. If the session log contains function_call.name values like functions.<tool>, resume fails with the validation error above.

Expected behavior

Codex should serialize tool/function call names using a valid name that matches the regex. If the internal tool is identified as functions.exec_command, the stored/transmitted name should be exec_command (or another regex-compliant identifier), not include a dot.

Suggested fix

  • When persisting tool calls and/or constructing the OpenAI request payload, sanitize name:
  • If it starts with functions., strip the prefix.
  • More generally, enforce ^[A-Za-z0-9_-]+$ before sending.

Workaround

I added a small local fixer script (idempotent) that scans ~/.codex/sessions and strips the functions. prefix for function_call entries where name is invalid. This unblocks resume, but it would be better fixed upstream in Codex.

Environment

  • codex-cli: 0.94.0 (Homebrew cask)
  • macOS: Apple Silicon

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗