openai / openai/openai-java

Error streaming back the ResponseFunctionCallArgumentsDoneEvent

Open
#682 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug spec
Dominant language
Kotlin
Stars
1.5k
Forks
264
Avg merge
9h 46m
Merged PRs (30d)
96

Description

I have an API using the responses streaming API. I am using it to route requests to specific tools, however after upgrading to 4.0+ these calls are failing with: java.util.concurrent.CompletionException: com.openai.errors.OpenAIInvalidDataException: name is not set

It looks like the issue was introduced here on line 318 of the ResponseFunctionCallArgumentsDoneEvent: https://github.com/openai/openai-java/commit/d58091bb3f9971f1354bcab8bff26bfe6efa4ad4#diff-d211a6e0ed129a3b2af84098071931cd23c4f078d175146d241dd15bf1cb9731R318

Now it is validating that name is set in this event, however OpenAI is not setting it in this use case.

You can see with this CURL, the streamed back event does not have name set.

curl -i -X POST \ -H "Authorization:Bearer <INSERT CLIENT ID>" \ -H "Content-Type:application/json" \ -d \ '{ "input": [ { "content": "What is the current situation in Minnesota?", "role": "user", "type": "message" } ], "instructions": "You act as the central router, deciding which specialized agent should handle the user\''s request based on the request itself and the conversational context.", "model": "gpt-4.1-mini", "store": false, "temperature": 0.2, "tool_choice": "auto", "tools": [ { "name": "transfer_to_location_intel_agent", "parameters": { "type": "object", "properties": { }, "additionalProperties": false, "required": [ ] }, "strict": true, "type": "function", "description": "Handoff to the location_intel_agent agent to handle the request." } ], "top_p": 0.1, "stream": true }' \ 'https://api.openai.com/v1/responses'

And here is the event:

event: response.function_call_arguments.done data: {"type":"response.function_call_arguments.done","arguments":"{}","item_id":"fc_071179986c0b4d5f016977cf066b3481939993c816cc22819c","output_index":0,"sequence_number":4}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ResponseFunctionCallArgumentsDoneEvent at the validation introduced around line 318 in the linked commit. Reproduce the response.function_call_arguments.done stream event using the provided curl request and verify that the event can be processed when name is absent; done means the failing Java streaming API call no longer raises OpenAIInvalidDataException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.