Skip to content

[@ai-sdk/openai]o4-mini, Invalid input Error when function call, because type is null instead of 'function' #6041

@xingxinglieo

Description

@xingxinglieo

Description

Error message:

[
  {
    "code": "invalid_union",
    "unionErrors": [
      {
        "issues": [
          {
            "received": null,
            "code": "invalid_literal",
            "expected": "function",
            "path": [
              "choices",
              0,
              "delta",
              "tool_calls",
              0,
              "type"
            ],
            "message": "Invalid literal value, expected \"function\""
          }
        ],
        "name": "ZodError"
      },
      {
        "issues": [
          {
            "code": "invalid_type",
            "expected": "object",
            "received": "undefined",
            "path": [
              "error"
            ],
            "message": "Required"
          }
        ],
        "name": "ZodError"
      }
    ],
    "path": [],
    "message": "Invalid input"
  }
]

here is chunk

{
    "id": "chatcmpl-BRfoGEp7fK6ZJgOFxL1aBjgKCiu2d",
    "object": "chat.completion.chunk",
    "created": 1745935272,
    "model": "o4-mini",
    "system_fingerprint": null,
    "choices": [
        {
            "delta": {
                "tool_calls": [
                    {
                        "index": 0,
                        "type": null,
                        "function": {
                            "arguments": "\":[\""
                        }
                    }
                ]
            },
            "logprobs": null,
            "finish_reason": null,
            "index": 0
        }
    ],
    "usage": null
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai/providerrelated to a provider package. Must be assigned together with at least one `provider/*` labelprovider/openaiIssues related to the @ai-sdk/openai providersupport

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions