Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.

Resolved 💬 1 comment Opened May 5, 2025 by rivershah Closed Aug 7, 2025

What version of Codex is running?

v0.1.2504301751

Which model were you using?

llama-3.3-70b-versatile, groq

What platform is your computer?

Linux 5.10.0-34-cloud-amd64 x86_64 unknown

What steps can reproduce the bug?

codex
╭──────────────────────────────────────────────────────────────╮
│ ● OpenAI Codex (research preview) v0.1.2504301751            │
╰──────────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────╮
│ localhost session: ad440f83890c42b2a777122282bfe344          │
│ ↳ workdir: /workspaces/atlas                                 │
│ ↳ model: deepseek-r1-distill-llama-70b                       │
│ ↳ provider: groq                                             │
│ ↳ approval: suggest                                          │
╰──────────────────────────────────────────────────────────────╯

    system
    Invalid command "/mod". Use /help to retrieve the list of commands.

    system
    Switched model to llama-3.3-70b-versatile
user
State your purpose

    codex
    I am an agentic coding assistant, and my purpose is to assist users with coding tasks by providing information, editing and modifying
    code, and running commands in a sandboxed environment. I can help with a wide range of tasks, such as debugging, testing, and
    completing code, as well as providing explanations and documentation. My goal is to help users complete their coding tasks efficiently
     and effectively, while also ensuring the quality and integrity of the code.
user
Review src/lib.rs and ensure no unneeded complexity
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│(  ●   ) 0s  Thinking.                                                                                     press Esc twice to interrupt │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
  ctrl+c to exit | "/" to see commands | enter to send — 100% context left

file:///usr/lib/node_modules/@openai/codex/dist/cli.js:474
`,"\r"]);$g.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function LBe(e,t){for(let a=t??0;a<e.length;a++){if(e[a]===10)return{preceding:a,index:a+1,carriage:!1};if(e[a]===13)return{preceding:a,index:a+1,carriage:!0}}return null}function rse(e){for(let n=0;n<e.length-1;n++){if(e[n]===10&&e[n+1]===10||e[n]===13&&e[n+1]===13)return n+2;if(e[n]===13&&e[n+1]===10&&n+3<e.length&&e[n+2]===13&&e[n+3]===10)return n+4}return-1}m();function v7(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let r=await t.read();return r?.done&&t.releaseLock(),r}catch(r){throw t.releaseLock(),r}},async return(){let r=t.cancel();return t.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}var Od=class e{constructor(t,r){this.iterator=t,this.controller=r}static fromSSEResponse(t,r){let n=!1;async function*a(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let i=!1;try{for await(let o of MBe(t,r))if(!i){if(o.data.startsWith("[DONE]")){i=!0;continue}if(o.event===null||o.event.startsWith("response.")||o.event.startsWith("transcript.")){let c;try{c=JSON.parse(o.data)}catch(d){throw console.error("Could not parse message into JSON:",o.data),console.error("From chunk:",o.raw),d}if(c&&c.error)throw new bi(void 0,c.error,void 0,I7(t.headers));yield c}else{let c;try{c=JSON.parse(o.data)}catch(d){throw console.error("Could not parse message into JSON:",o.data),console.error("From chunk:",o.raw),d}if(o.event=="error")throw new bi(void 0,c.error,c.message,void 0);yield{event:o.event,data:c}}}i=!0}catch(o){if(o instanceof Error&&o.name==="AbortError")return;throw o}finally{i||r.abort()}}return new e(a,r)}static fromReadableStream(t,r){let n=!1;async function*a(){let o=new $g,c=v7(t);for await(let d of c)for(let f of o.decode(d))yield f;for(let d of o.flush())yield d}async function*i(){if(n)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let o=!1;try{for await(let c of a())o||c&&(yield JSON.parse(c));o=!0}catch(c){if(c instanceof Error&&c.name==="AbortError")return;throw c}finally{o||r.abort()}}return new e(i,r)}[Symbol.asyncIterator](){return this.iterator()}tee(){let t=[],r=[],n=this.iterator(),a=i=>({next:()=>{if(i.length===0){let o=n.next();t.push(o),r.push(o)}return i.shift()}});return[new e(()=>a(t),this.controller),new e(()=>a(r),this.controller)]}toReadableStream(){let t=this,r,n=new TextEncoder;return new fO({async start(){r=t[Symbol.asyncIterator]()},async pull(a){try{let{value:i,done:o}=await r.next();if(o)return a.close();let c=n.encode(JSON.stringify(i)+`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

e [Error]: Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.
    at e.a [as iterator] (file:///usr/lib/node_modules/@openai/codex/dist/cli.js:474:1514)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async zxe (file:///usr/lib/node_modules/@openai/codex/dist/cli.js:372:7716)
    at async dE.run (file:///usr/lib/node_modules/@openai/codex/dist/cli.js:491:2777) {
  status: undefined,
  headers: undefined,
  request_id: undefined,
  error: {
    message: "Failed to call a function. Please adjust your prompt. See 'failed_generation' for more details.",
    type: 'invalid_request_error',
    code: 'tool_use_failed',
    failed_generation: 'Tool use failed: JSON does not match the expected schema for tool calls',
    status_code: 400
  },
  code: 'tool_use_failed',
  param: undefined,
  type: 'invalid_request_error'
}

Node.js v22.15.0

What is the expected behavior?

_No response_

What do you see instead?

_No response_

Additional information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗