openai/codex · error

missing program for PTY spawn

Error message

missing program for PTY spawn

What it means

The PTY spawn entry point was called with an empty program string. The guard fires before any PTY allocation; the command to run was never configured.

Solutions

  1. Populate the command/program field before spawning
  2. Default to an interactive shell when program is empty
  3. Validate command configuration upstream and report a user-facing error
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/utils/pty/src/pty.rs:137 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/0eb186d389df4ad0. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/utils/pty/src/pty.rs:137

    #[cfg(not(windows))]
    {
        native_pty_system()
    }
}

/// Spawn a process attached to a PTY, preserving selected inherited file
/// descriptors across exec on Unix.
pub async fn spawn_process(
    program: &str,
    args: &[String],
    cwd: &Path,
    env: &HashMap<String, String>,
    arg0: &Option<String>,
    size: TerminalSize,
    inherited_fds: &[i32],
) -> Result<SpawnedProcess> {
    if program.is_empty() {
        anyhow::bail!("missing program for PTY spawn");
    }

    #[cfg(not(unix))]
    let _ = inherited_fds;

    #[cfg(unix)]
    if !inherited_fds.is_empty() {
        return spawn_process_preserving_fds(program, args, cwd, env, arg0, size, inherited_fds)
            .await;
    }

    spawn_process_portable(program, args, cwd, env, arg0, size).await
}

async fn spawn_process_portable(
    program: &str,
    args: &[String],
    cwd: &Path,

View on GitHub (pinned to 339751715c)