Skip to content

Conversation

@nthmost-orkes
Copy link
Contributor

Pull Request type

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • WHOSUSING.md
  • Other (please describe):

Changes in this PR

Fix NPE in batchPoll by returning empty list instead of 204

Problem

The batchPoll endpoint returned 204 No Content when no tasks were available, causing NPE in client libraries that expected a list object.

Solution

Changed TaskResource.batchPoll() to always return 200 OK with an empty list instead of 204 No Content.

So clients always get 200 OK with either:

  • A populated list [task1, task2, ...] when tasks are available
  • An empty list [] when no tasks are available

Impact

Changes

  • rest/src/main/java/com/netflix/conductor/rest/controllers/TaskResource.java:73-84

SDK Compatibility Analysis for batchPoll Fix (generated by Claude Code):

Java SDK (java-sdk/conductor-client/src/main/java/com/netflix/conductor/client/http/TaskClient.java:546-561):

  • Return type: List
  • Expected behavior: Returns List directly from resp.getData()
  • Impact: ✅ No negative impact - Already expects a list, will handle empty list correctly

Go SDK (go-sdk/sdk/client/api_task_resource.go:92-93):

  • Return type: []model.Task (Go slice)
  • Expected behavior: Declares var result []model.Task and unmarshals response into it
  • Impact: ✅ No negative impact - Go slices handle empty arrays naturally, JSON unmarshal will create empty slice

C# SDK (csharp-sdk/Conductor/Api/TaskResourceApi.cs:263-267):

  • Return type: List
  • Expected behavior: Returns List from BatchPollWithHttpInfo
  • Impact: ✅ No negative impact - C# List handles empty lists correctly

Python SDK:

  • Return type: list[Task]
  • Expected behavior: Expects list type from API
  • Impact: ✅ No negative impact - Already verified

All four SDKs expect a list/array type from the batchPoll endpoint:

  • Java: List
  • Go: []model.Task
  • C#: List
  • Python: list[Task]

@nthmost-orkes nthmost-orkes added the bug Something isn't working label Oct 10, 2025
@nthmost-orkes nthmost-orkes added the enhancement New feature or request label Oct 10, 2025
@zachsirotto
Copy link

Looking forward to this! Thanks so much 👍

@nthmost-orkes nthmost-orkes merged commit ed72239 into main Oct 16, 2025
10 of 15 checks passed
@nthmost-orkes nthmost-orkes deleted the 602-fix-batchpoll-npe-return-empty-list branch October 16, 2025 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants