Skip to content

ERROR Bad substitution: JSON.stringify #87

Closed

Description

@HamedMP

hi, i ran a command and received the patch but i couldn't accept/reject it due to this "bad substitution" error.

Image

running it with default model, node 22 (with fnm as node env manager) in warp terminal. i will try in other terminal apps too.

is this due to model response or related to the package? the patch as far as i can see is correct (it's a new file creation).

Activity

  1. HamedMP commented on Apr 16, 2025

    @HamedMP
    Author

    interestingly i don't see where this error is generated in the code, seems the error message is coming from the api

    Image
  2. bolinfest commented on Apr 16, 2025

    @bolinfest
    Collaborator

    @HamedMP Thanks for the report! If it's not sensitive, could you share the argument to the apply-patch call?

    I suspect this is happening here:

    https://github.com/ljharb/shell-quote/blob/b19fc77e66871eee10a9978d54c27d802a1da99b/parse.js#L121-L132

    So it seems likely that there is something like ${JSON.stringify} in the argument to bash -lc << 'EOF' *** Begin... and parse() from the shell-quote module is interpreting that as an environment variable substitution rather than a literal.

    Looking into a repro and a fix...

  3. bolinfest commented on Apr 16, 2025

    @bolinfest
    Collaborator

    @HamedMP we just pushed version 0.1.2504161551 of @openai/codex which I believe should fix this, so give it a shot?

  4. HamedMP commented on Apr 17, 2025

    @HamedMP
    Author

    thanks for the update, i'll give it a try.

    p.s. that i couldn't directly update it, uninstalled and reinstalled it to make it work

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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