Skip to content

codex exec resume --last rejects prompt when --json is set #6717

@dkhokhlov

Description

@dkhokhlov

What version of Codex is running?

0.58.0

What subscription do you have?

team

Which model were you using?

gpt-5 codex

What platform is your computer?

Linux 6.2.0-39-generic x86_64 x86_64

What issue are you seeing?

Running the exec CLI with both --json and resume --last fails whenever a prompt is provided after --last. Clap treats that positional as SESSION_ID, so it errors with “the argument '--last' cannot be used with '[SESSION_ID]'”.

Execution aborts immediately with error: the argument '--last' cannot be used with '[SESSION_ID]'.

What steps can reproduce the bug?

Run:
codex exec --json resume --last "2+2"

What is the expected behavior?

The command resumes the most recent session and sends "2+2" as the new prompt while still emitting JSON events.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexecIssues related to the `codex exec` subcommand

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions