openai / openai/codex

[Linux desktop] GUI launch fails with `Unexpected end of JSON input` when `~/package.json` is empty

Open
#45,117 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug Linux
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What version of the Codex App are you using?

26.903.61454 (amd64), installed as the Debian package chatgpt via APT/dpkg from the OpenAI Linux repository.

What platform is your computer?

Ubuntu, GNOME, Wayland (application rendering through XWayland/X11).

What issue are you seeing?

After updating from 26.818.31338 to 26.903.61454, launching the desktop app from the GNOME application icon stopped opening a window, while launching the same installed application from a terminal still worked.

The graphical launcher itself was valid and pointed to the same executable chain used by the working terminal launch:

/usr/share/applications/chatgpt.desktop
Exec=chatgpt %U

/usr/bin/chatgpt
  -> /usr/lib/chatgpt/codex-launcher
  -> /usr/lib/chatgpt/ChatGPT

No duplicate or stale .desktop entry was found, and the package files and permissions were consistent according to dpkg.

A graphical launch after the update produced this bootstrap error before any window ready-to-show log entry:

SyntaxError: Unexpected end of JSON input

The system also had an empty file at:

/home/<user>/package.json

The file was exactly 0 bytes.

Steps that resolved the issue
  1. Preserve the empty ~/package.json without modifying its contents.
  2. Move it out of the home directory, for example:
/home/<user>/_deprecated/package.json
  1. Fully terminate any existing terminal-launched Codex/ChatGPT instance.
  2. Launch the app again from the GNOME application icon.

After moving the empty ~/package.json, the app opened normally from the graphical launcher.

The result was then confirmed again:

  • with both the app and terminal closed; and
  • after a full computer reboot.

In both cases, the graphical icon launched the app normally.

Why this looks related to package.json

The installed build appears to inspect application metadata during bootstrap and, when the expected internal build metadata is absent, may attempt to parse a package.json from the current/default working context.

In the graphical-launch context, the empty ~/package.json is consistent with the observed JSON.parse failure (Unexpected end of JSON input). In the terminal-launch context used for comparison, the working directory did not contain that file and the app launched successfully.

I am treating this as a probable cause rather than a fully proven one because I did not restore the empty file and intentionally reproduce the failure again after the workaround succeeded.

Expected behavior

The desktop app should not fail to start because an unrelated package.json in the user's home directory is empty or malformed.

At minimum, parsing of external/project metadata during app bootstrap should be guarded so that a malformed or empty file cannot prevent the GUI from opening.

Additional information
  • Previous graphical launch on 26.818.31338 reached window ready-to-show.
  • The first observed graphical launch after the update to 26.903.61454 failed during bootstrap with Unexpected end of JSON input.
  • No .desktop mismatch, stale launcher, broken symlink, missing executable, permission problem, or dpkg integrity problem was found.
  • No reinstall, downgrade, launcher edit, or environment-variable change was required.
  • The workaround was only to move the empty home-level package.json out of ~/.
  • The issue remained resolved after reboot.

If useful, I can provide a sanitized version of the local diagnostic details and relevant log excerpts.

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 by reproducing the GUI launch with an empty ~/package.json and compare it with a terminal launch, using the reported Unexpected end of JSON input bootstrap error as the starting point. Trace the desktop bootstrap path behind /usr/lib/chatgpt/ChatGPT to identify where the external metadata is parsed. Done means the GUI opens normally even when the home-level package.json is empty or malformed, with regression coverage for that case.

Written by the indexing model from the issue text.

Assessment

Tech stack
json, linux, rust
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.