[GH-ISSUE #4385] [BUG]: GPT-5 models cannot use tools #2798

Closed
opened 2026-02-22 18:31:18 -05:00 by yindo · 1 comment
Owner

Originally created by @Bender250 on GitHub (Sep 16, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4385

Originally assigned to: @shatfield4 on GitHub.

How are you running AnythingLLM?

AnythingLLM desktop app

What happened?

GPT-5 family models does not support message.role = "function". AnythingLLM uses it and the request to OpenAI crashes with 400 Unsupported value.

Image

Here are logs:

[backend] info: [AgentHandler] [debug]: @agent is attempting to call `web-scraping` tool
[backend] info: [EncryptionManager] Loaded existing key & salt for encrypting arbitrary data.
[collector] info: -- Working URL https://docs.anythingllm.com/installation-desktop/debug => (text) --
[Electron:Collector] Page Content loaded - cleaning up timers
[Electron:Collector] Scraping page content as  text
[collector] info: Cleaning up request handler for request ID.
[backend] info: [TokenManager] Initialized new TokenManager instance for model: gpt-5-mini
[backend] error:    error: 400 Unsupported value: 'messages[2].role' does not support 'function' with this model. Error: 400 Unsupported value: 'messages[2].role' does not support 'function' with this model.
    at r.complete (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:313:8244)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Dl.handleExecution (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:332:406)
    at async Dl.handleExecution (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:332:1345)
    at async Dl.reply (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:332:274)
    at async Dl.chat (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:313:46286)
    at async Dl.start (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:313:45720)
    at async aK (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:369:2717)
    at async /Applications/AnythingLLM.app/Contents/Resources/backend/server.js:369:2243
[backend] info: [AgentHandler] End 4292d7b4-6a9e-477e-af0b-6362b6fa756a::openai:gpt-5-mini

This discussion suggests that GPT-5 family models changed the API and are now using "tool" as message type for tool calls, not "function".

Are there known steps to reproduce?

  1. Set GPT-5 / GPT-5-mini (I guess even GPT-5-nano) as model
  2. Send this message: @agent Collect the text of this page: https://docs.anythingllm.com/installation-desktop/debug (or any other tool call)

(Older models like GPT-4.1 work fine.)

Originally created by @Bender250 on GitHub (Sep 16, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/4385 Originally assigned to: @shatfield4 on GitHub. ### How are you running AnythingLLM? AnythingLLM desktop app ### What happened? GPT-5 family models does not support `message.role = "function"`. AnythingLLM uses it and the request to OpenAI crashes with 400 Unsupported value. <img width="833" height="518" alt="Image" src="https://github.com/user-attachments/assets/e6931223-d390-4f2c-814f-cd46db801807" /> Here are logs: ``` [backend] info: [AgentHandler] [debug]: @agent is attempting to call `web-scraping` tool [backend] info: [EncryptionManager] Loaded existing key & salt for encrypting arbitrary data. [collector] info: -- Working URL https://docs.anythingllm.com/installation-desktop/debug => (text) -- [Electron:Collector] Page Content loaded - cleaning up timers [Electron:Collector] Scraping page content as text [collector] info: Cleaning up request handler for request ID. [backend] info: [TokenManager] Initialized new TokenManager instance for model: gpt-5-mini [backend] error: error: 400 Unsupported value: 'messages[2].role' does not support 'function' with this model. Error: 400 Unsupported value: 'messages[2].role' does not support 'function' with this model. at r.complete (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:313:8244) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Dl.handleExecution (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:332:406) at async Dl.handleExecution (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:332:1345) at async Dl.reply (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:332:274) at async Dl.chat (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:313:46286) at async Dl.start (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:313:45720) at async aK (/Applications/AnythingLLM.app/Contents/Resources/backend/server.js:369:2717) at async /Applications/AnythingLLM.app/Contents/Resources/backend/server.js:369:2243 [backend] info: [AgentHandler] End 4292d7b4-6a9e-477e-af0b-6362b6fa756a::openai:gpt-5-mini ``` This [discussion](https://community.openai.com/t/gpt-5-400-unsupported-value-messages-6-role-does-not-support-function-with-this-model/1337151/3) suggests that GPT-5 family models changed the API and are now using `"tool"` as message type for tool calls, not `"function"`. ### Are there known steps to reproduce? 1. Set GPT-5 / GPT-5-mini (I guess even GPT-5-nano) as model 2. Send this message: `@agent Collect the text of this page: https://docs.anythingllm.com/installation-desktop/debug` (or any other tool call) (Older models like GPT-4.1 work fine.)
yindo added the possible buginvestigating labels 2026-02-22 18:31:18 -05:00
yindo closed this issue 2026-02-22 18:31:18 -05:00
Author
Owner

@timothycarambat commented on GitHub (Oct 1, 2025):

resolved by #4467

@timothycarambat commented on GitHub (Oct 1, 2025): resolved by #4467
yindo changed title from [BUG]: GPT-5 models cannot use tools to [GH-ISSUE #4385] [BUG]: GPT-5 models cannot use tools 2026-06-05 14:48:36 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#2798