openai / openai/codex

[Bug] Codex VS Code Extension: "Error creating chat: unknown special value: ["bytes", {...}]" in Webview RPC deserializer

Open
#43,861 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app-server bug extension windows-os
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What version of the IDE extension are you using?

26.5901.22334

What subscription do you have?

ChatGPT Plus

Which IDE are you using?

VS Code

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

When attempting to resume or continue an existing chat in the Codex sidebar, the webview fails to load and displays this error banner:

Error creating chat: unknown special value: ["bytes", {"0": 123, "1": 10, "2": 32, "3": 32, "4": 34, ...}]

The conversation fails to open or accept further input.

What steps can reproduce the bug?
Steps:
  1. Have an active Codex thread with changes or tool outputs that include byte buffers or serialized state (e.g. file content, audit records, or git state).
  2. Close or restart the session.
  3. Re-open or click "Continue" on the chat in the VS Code sidebar.
  4. The webview crashes with: unknown special value: ["bytes", {"0": ...}].
Technical Root Cause:

In the extension's RPC transport (capn-rpc), UI is initialized with encodingLevel = "jsonCompatibleWithBytes".

When messages pass between the extension host and webview over VS Code's postMessage, JSON serialization turns Uint8Array buffers into plain JavaScript Objects with numeric keys ({ "0": byte, "1": byte, ... }).

In Ore.evaluateImpl under case "bytes":, the deserializer only checks:

  • e[1] instanceof Uint8Array
  • typeof e[1] === "string"

Because { "0": 123, ... } matches neither condition, it hits else break; and falls through to:
throw new TypeError('unknown special value: ' + JSON.stringify(e))

What is the expected behavior?

The chat session should load and continue normally without throwing an RPC deserialization error when the session history contains binary buffers or serialized state.

Additional information
Verified Fix

In both out/extension.js and the Webview bundle (webview/assets/app-initial-*.js) under case "bytes": (or case \bytes`:) in evaluateImpl`, adding support for plain object/array representations completely resolves the issue:

// Before:
case "bytes": {
    let s;
    if (e[1] instanceof Uint8Array) s = e[1];
    else if (typeof e[1] == "string") ...
    else break;
    ...
}

// After:
case "bytes": {
    let s;
    if (e[1] instanceof Uint8Array) s = e[1];
    else if (typeof e[1] == "string") ...
    else if (e[1] && typeof e[1] === "object")
        s = new Uint8Array(Array.isArray(e[1]) ? e[1] : Array.isArray(e[1].data) ? e[1].data : Object.values(e[1]));
    else break;
    ...
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in out/extension.js and the webview/assets/app-initial-*.js bundles, at evaluateImpl's case "bytes" handling in the capn-rpc UI transport. Reproduce reopening a thread with serialized byte data, then verify both the extension and webview can deserialize the plain object or array representation and that the chat resumes without the error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, vscode
Domain
desktop, devtools, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.