Skip to content

AI_APICallError occurs after running Opencode with Azure GPT-5 Codex and GPT-5 for several minutes #3044

Closed

Description

@Quanta-Naut

The bug
After starting Opencode with the Ai Foundry Azure GPT-5 Codex and GPT-5 model, the application works as expected initially. However, after running it for a few minutes, the following error appears:

AI_APICallError: Item 'fc_0dc4d92ad113352f0068e68182f9c0819783624eeb74dcfc0e' of type 'function_call' was provided without its required 'reasoning' item:
'rs_0dc4d92ad113352f0068e68182ada481978281511f6e4248d4'.

Configuration: I tried this fix, but nothing changed

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "azure": {
      "models": {
        "gpt-5-codex": {
          "id": "gpt-5-codex",
          "name": "Azure GPT-5 Codex",
          "reasoning": false 
        }
      }
    }
  }
}

Even when I don't have the above config, I get the error.

Steps to Reproduce

  1. Start Opencode with the Ai Foundry Azure GPT-5 Codex model.
  2. Run it for a few minutes.
  3. Observe the error output above.

Expected behavior
Opencode should continue running without encountering this error.

Additional Information

  • The error appears only after several minutes of runtime, not immediately.
  • Please investigate why this error occurs after successful initial execution and how to resolve it.

Activity

  1. github-actions commented on Oct 8, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. patrafter1999 commented on Oct 9, 2025

    @patrafter1999

    I have the same issue. This happens with and without the tool in ./.opencode/tool/mytool.ts

    AI_APICallError: litellm.BadRequestError: AzureException BadRequestError - {
      "error": {
        "message": "Missing required parameter: 'tools[0].name'.",
        "type": "invalid_request_error",
        "param": "tools[0].name",
        "code": "missing_required_parameter"
      }
    }. Received Model Group=gpt-5-codex
    Available Model Group Fallbacks=None
    
  3. rekram1-node commented on Oct 9, 2025

    @rekram1-node
    Collaborator

    @patrafter1999 you said same error but that’s an entirely different error?

  4. Quanta-Naut commented on Oct 9, 2025

    @Quanta-Naut
    Author

    @rekram1-node any notable solutions that work, or any workarounds available??

  5. rekram1-node commented on Oct 9, 2025

    @rekram1-node
    Collaborator

    @Quanta-Naut lemme do an azure deployment to test, i cant replicate w/ the other providers
    ill try to get back to u on this tmr (2am where i am rn)

  6. rekram1-node commented on Oct 9, 2025

    @rekram1-node
    Collaborator

    and this is on latest right? or at least some v0.14.xxx right?

  7. Quanta-Naut commented on Oct 9, 2025

    @Quanta-Naut
    Author

    @rekram1-node Yes this is on the latest.

  8. sheldonhull commented on Oct 17, 2025

    @sheldonhull

    I ran into this today as well

  9. rekram1-node commented on Oct 17, 2025

    @rekram1-node
    Collaborator

    @sheldonhull are you on 0.15.7? Also are you also using azure?

  10. jaccoh commented on Oct 19, 2025

    @jaccoh

    I get this issue with Codex as well.. so it not entirely an opencode issue I'm afraid. Although it would be good to have a work-around as it makes it totally unusable.

  11. rekram1-node commented on Oct 19, 2025

    @rekram1-node
    Collaborator

    @jaccoh can you show me your opencode config? This has to do with reasoning metadata being dropped or missing, maybe your config would help me figure it out

  12. rekram1-node commented on Oct 19, 2025

    @rekram1-node
    Collaborator

    @jaccoh are you exportng it as toml? What's this?
    [projects."/Users/jhoeve/PycharmProjects/bank_transactions_importer"]
    trust_level = "trusted"

    I don't think you shared your opencode.json?

  13. jaccoh commented on Oct 19, 2025

    @jaccoh

    @jaccoh are you exportng it as toml? What's this? [projects."/Users/jhoeve/PycharmProjects/bank_transactions_importer"] trust_level = "trusted"

    I don't think you shared your opencode.json?

    oops :)

    {
     "$schema": "https://opencode.ai/config.json",
      "provider": {
        "azure": {
          "models": {
            "gpt-5-codex": {
              "options": {
                "reasoningEffort": "high",
                "textVerbosity": "low",
                "reasoningSummary": "auto",
                "include": ["reasoning.encrypted_content"],
              }
            }
          }
        }
      }
    }
    
  14. adeperio commented on Oct 20, 2025

    @adeperio

    Hi @rekram1-node I get a similar error with all the gpt-5 models at the moment.

    AI_APICallError: Item 'msg_0288ca1a50a0201e0068f16f8334d881968df03cba2706156d' of type 'message' was provided without its required 'reasoning' item:
    'rs_0288ca1a50a0201e0068f16f7c85448196996ec857642b076b'.

    I simplified my opencode.json to this:

    {
        "$schema": "https://opencode.ai/config.json",
        "instructions": [
            "CLAUDE.md"
        ],
        "autoupdate": true,
        "mcp": {
            "firecrawl": {
                "type": "local",
                "command": [
                    "npx",
                    "-y",
                    "firecrawl-mcp"
                ],
                "enabled": true,
                "environment": {
                    "FIRECRAWL_API_KEY": "xxx"
                }
            },
            "sequential-thinking": {
                "type": "local",
                "command": [
                    "npx",
                    "-y",
                    "@modelcontextprotocol/server-sequential-thinking"
                ],
                "enabled": true
            }
        }
    }
    

    Any idea what might be happening?

    I'm on 0.15.8

  15. jaccoh commented on Oct 20, 2025

    @jaccoh

    IMHO the error is clear.. apparently answers can sometimes not contain reasoning and open code fails on it

  16. rekram1-node commented on Oct 20, 2025

    @rekram1-node
    Collaborator

    is this happening no matter what you send or does it only happen if you do an abort mid convo

  17. adeperio commented on Oct 20, 2025

    @adeperio

    Hi @rekram1-node it happens no matter what I send. I have had to switch off openai models.

  18. rekram1-node commented on Oct 21, 2025

    @rekram1-node
    Collaborator

    should be fixed in next release if you set this in your opencode.json:

    {
      "azure": {
          "env": [
            "AZURE_API"
          ],
          "models": {
            "gpt-5-codex": {
              "name": "GPT-5-codex",
              "options": {
                "parallelToolCalls": false, # or "store": false
              }
            }
          }
        }
    }
    

    Thank u @zWingz

  19. adeperio commented on Oct 21, 2025

    @adeperio

    Awesome thanks @rekram1-node that worked

      "provider": {
        "openai": {
          "models": {
            "gpt-5-codex": {
              "id": "gpt-5-codex",
              "name": "GPT-5 Codex",
              "options": {
                "reasoningEffort": "medium",
                "textVerbosity": "low",
                "parallelToolCalls": false
              }
            },
            "gpt-5-mini": {
              "id": "gpt-5-mini",
              "name": "GPT-5 Mini",
              "options": {
                "reasoningEffort": "medium",
                "textVerbosity": "low",
                "parallelToolCalls": false
              }
            }
          }
        }
      },
    
  20. rekram1-node commented on Oct 21, 2025

    @rekram1-node
    Collaborator

    ill release it tmr so we can fix azure, I will also look into "store": false and if we can use it a default and the tradeoffs so we can prevent this error going forward

  21. adeperio commented on Oct 21, 2025

    @adeperio

    Mine actually worked without tomorrow's release. I did upgrade to 0.15.10, but changed my config to the one I supplied. (I think my issue is slightly different as I'm not using azure) My error message was also "of type 'message'" instead of "of type 'function_call'"

  22. rekram1-node commented on Oct 21, 2025

    @rekram1-node
    Collaborator

    u were using openai so that will work, but for azure it wont (yet) until i release, thats what my previous message meant to say

  23. adeperio commented on Oct 21, 2025

    @adeperio

    Ahh understood. Thanks!

  24. jaccoh commented on Oct 21, 2025

    @jaccoh

    Is it the .10 I need to test?

  25. rekram1-node commented on Oct 21, 2025

    @rekram1-node
    Collaborator

    i will release today it will be 0.15.11

    Edit: released

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

Metadata

Metadata

Assignees

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