Skip to content

[BUG] when TOML contains a { charactor it failed to recognize it a valid TOML #4378

Closed

Description

@codeandroad

Description

executing headroom wrap code command on my macbook(M series) will prompt me to this error message:

 MCP retrieve tool: install failed (failed): /Users/codefox/.codex/config.toml is not valid TOML (Invalid initial character for a key part (at line 189, column 8)); refusing to overwrite. Fix or remove the file, then re-run.
  Serena MCP: install failed (failed): /Users/codefox/.codex/config.toml is not valid TOML (Invalid initial character for a key part (at line 189, column 8)); refusing to overwrite. Fix or remove the file, then re-run.

  ╔═══════════════════════════════════════════════╗
  ║              HEADROOM WRAP: CODEX             ║
  ╚═══════════════════════════════════════════════╝

  Persistent deployment 'default' on port 8787 did not expose routing config; starting a dedicated proxy on a different port instead.
  Port 8787 is in use, using port 8788 instead.
  Warning: could not read the extensions of the proxy on port 8787; the dedicated proxy on port 8788 starts without any. Set HEADROOM_PROXY_EXTENSIONS=<names> to carry them.
  Starting Headroom proxy on port 8788...
  Logs: /Users/codefox/.headroom/logs/proxy-8788.log
  Proxy ready — dashboard: http://127.0.0.1:8788/dashboard
  Error: could not read Codex config for session routing: Invalid initial character for a key part (at line 189, column 8)

the cause is that I have a { line at line 189

189 env = {
190   DINGTALK_Client_ID = "**********",
  
    }

Activity

  1. Ehsan-hash commented on Oct 22, 2026

    @Ehsan-hash
    Contributor

    Thanks for the example. I reproduced that error with the multiline inline table on Python 3.11.17, 3.12.15 and 3.14.8. The same sample parses on Python 3.15.0. Headroom currently uses the standard library's tomllib on Python 3.11 and newer, so this appears to depend on the parser version rather than the { character alone.

    Keeping the inline table on one line works on all four versions I checked:

    env = { DINGTALK_Client_ID = "example" }

    Which Python version is running your Headroom installation? That would help distinguish a compatibility limitation from a problem with how Headroom reads the file.

  2. codeandroad commented on Oct 24, 2026

    @codeandroad
    Author

    python 3.14

  3. Ehsan-hash commented on Oct 24, 2026

    @Ehsan-hash
    Contributor

    Thanks, that matches the Python 3.14 result above. Its tomllib implements TOML 1.0, whose inline-table syntax does not allow those newlines between the braces.

    Keeping the env inline table on one line, as in the previous example, is the workaround I verified on Python 3.14.8. Please try that form and let me know whether this parsing error goes away.

  4. codeandroad commented on Oct 24, 2026

    @codeandroad
    Author

    Yes, it did go away.

  5. added a commit that references this issue on Oct 29, 2026
    4a851ed
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions