Skip to content

fix: handle null response in HttpTarget to prevent NPE#116

Merged
omerlh merged 1 commit intomainfrom
fix/http-target-null-response-npe
Feb 8, 2026
Merged

fix: handle null response in HttpTarget to prevent NPE#116
omerlh merged 1 commit intomainfrom
fix/http-target-null-response-npe

Conversation

@omerlh
Copy link
Collaborator

@omerlh omerlh commented Feb 8, 2026

OkHttp's async callback can receive a null response when the call times out or fails (e.g. connection error). The batch call handler and onExecutionSuccess dereferenced response without a null check, causing NullPointerException and process exit (CrashLoopBackOff in container environments).

  • Batch call: compute statusCode and body string with null checks; use -1 when response is null so retry/DLQ logic still runs.
  • Single-record onExecutionSuccess: early return when response is null; report to monitor, optionally produce to DLQ, and return failed future instead of NPE in try-with-resources.

OkHttp's async callback can receive a null response when the call times out
or fails (e.g. connection error). The batch call handler and onExecutionSuccess
dereferenced response without a null check, causing NullPointerException and
process exit (CrashLoopBackOff in container environments).

- Batch call: compute statusCode and body string with null checks; use -1
  when response is null so retry/DLQ logic still runs.
- Single-record onExecutionSuccess: early return when response is null;
  report to monitor, optionally produce to DLQ, and return failed future
  instead of NPE in try-with-resources.

Co-authored-by: Cursor <cursoragent@cursor.com>
@omerlh omerlh requested a review from guysegal February 8, 2026 17:55
@omerlh omerlh merged commit 699f6ab into main Feb 8, 2026
1 check passed
@omerlh omerlh deleted the fix/http-target-null-response-npe branch February 8, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants