Skip to content

Array schema missing 'items' error when using OpenAI plugin with Tool (Function Calling) #32894

@codeMonkey-shin

Description

@codeMonkey-shin

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.11.4

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When using a custom tool (img to pdf conversion tool) with the OpenAI plugin, the following error occurs:

array schema missing items., 'type': 'invalid_request_error', 
'param': 'tools[3].function.parameters', 
'code': 'invalid_function_parameters'

The same tool works perfectly fine with other model plugins, so the issue appears to be specific to the OpenAI plugin.


Steps to Reproduce

  1. Create a custom tool that includes an array type parameter in its schema
  2. Set the app to use the OpenAI plugin (e.g., gpt-4.1, gpt-5.2
  3. Run the workflow or agent
  4. Error is thrown at tool call stage

Possible Cause

It seems OpenAI has recently updated their API requirements for function calling schemas — specifically, array type parameters now require an items field to be explicitly defined.

This may require Dify to validate or auto-complete array schemas before passing them to the OpenAI API.


Environment

  • Model Provider: OpenAI plugin
  • Works on: ✅ Google Gemini plugin
  • Works on: ✅ Anthropic plugin
  • Works on: ✅ OpenAI Compatible plugin
  • Fails on: ❌ OpenAI plugin

✔️ Expected Behavior

The tool should work with the OpenAI plugin as it does with other model plugins.

❌ Actual Behavior

OpenAI API returns invalid_function_parameters error, stating that the array schema is missing the items field.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions