Skip to content

Improve missing API key error: avoid ENOENT on missing server info JSON #70

@jbohnslav

Description

@jbohnslav

Summary

When openai/codex-action@v1 runs without an openai-api-key value, it fails with a low-signal ENOENT error about a missing server info JSON file.

Actual behavior

The action fails at read-server-info with:

Error reading server info: Error: ENOENT: no such file or directory, open '/home/runner/.codex/<run_id>.json'
Error: Failed to read server info from /home/runner/.codex/<run_id>.json

In this case, the root problem was that secrets.OPENAI_API_KEY was not set in the repo.

Expected behavior

A clear failure message like:

  • openai-api-key input is empty (did you forget to set OPENAI_API_KEY secret?)

instead of a downstream file-not-found error.

Why this is confusing

ENOENT on an internal .codex/<run_id>.json file reads like a runtime crash, not a missing input. It makes debugging much harder than necessary.

Suggested fix

Either:

  1. Add an explicit preflight validation for missing openai-api-key when required, or
  2. Guard read-server-info so it cannot run unless proxy startup/server-info creation was attempted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions