Skip to content

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

Open

Description

@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

Activity

  1. added
    bug
    CLI
    tool-calls
    on Feb 3, 2026
  2. etraut-openai commented on Feb 3, 2026

    @etraut-openai
    Contributor

    If you're able to repro this, please use the /feedback slash command to upload your logs and session details, then post the thread ID here.

  3. CieveMe commented on Oct 22, 2026

    @CieveMe

    Related current Windows case, with a different invalid character than the original dot-separated example.

    On October 23, 2026 at 00:40:31 UTC+8, resuming an existing chat with gpt-6.1-sol (medium) failed with HTTP 400:

    Invalid response.create payload: Invalid 'input[394].name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_.-]+\\z'.
    

    Desktop logs identify client version 26.1016.51333; the model manager reports 0.163.0.

    A read-only inspection of the 721 stored response items finds exactly one function-call name outside the character set allowed by this error: mcp__codex_app::list_projects. The colon characters are rejected by this character set; a dot is permitted in this particular error, unlike the older regex in the original issue. The historical call was inspected as data only; it was not executed.

    Important limitation: this stored call is at zero-based response-item index 392, whereas the server reports wire input index 394. Stored response-item 394 is a reasoning item. The complete outbound request was not captured, so I cannot prove that wire input 394 is the stored call at index 392 or account for the two-item offset. This is a candidate replay/namespace normalization problem, not a confirmed source-level diagnosis.

    The history also contains foreign reasoning items, but the observed rejection in this chat is specifically the name validation error. No transcript/database/configuration was modified and no recovery was tested. Please advise on a supported migration or normalization path for historical namespaced tool calls.

    Disclosure: AI assistance was used to prepare this comment; the reported metadata was checked against local files and logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIbugtool-calls

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions