Skip to content

fix(http): return 400 for empty/invalid JSON on required HTTP bodies#8773

Open
AffanBinFaisal wants to merge 1 commit into
triton-inference-server:mainfrom
AffanBinFaisal:fix/sagemaker-empty-invocations-400
Open

fix(http): return 400 for empty/invalid JSON on required HTTP bodies#8773
AffanBinFaisal wants to merge 1 commit into
triton-inference-server:mainfrom
AffanBinFaisal:fix/sagemaker-empty-invocations-400

Conversation

@AffanBinFaisal
Copy link
Copy Markdown

@AffanBinFaisal AffanBinFaisal commented May 10, 2026

Description

Fixes #8762.

SageMaker single-model /invocations\ (and any path using \EVRequestToJson\ with a required JSON body) returned HTTP 500 for empty or non-JSON bodies because parse failures were reported as \TRITONSERVER_ERROR_INTERNAL.

Changes

  • Return \TRITONSERVER_ERROR_INVALID_ARG\ for zero-length bodies when empty bodies are not allowed.
  • Remap TritonJson parse errors (message prefix \ ailed to parse the request JSON buffer) from \INTERNAL\ to \INVALID_ARG\ so \HttpCodeFromError\ returns 400.
  • Add \L0_sagemaker\ regression tests (empty body, \\x00, whitespace); update \UNIT_TEST_COUNT.

Testing

  • \python -m pre_commit run --files src/http_server.cc qa/L0_sagemaker/sagemaker_test.py qa/L0_sagemaker/test.sh\ (all hooks passed locally).
  • Full \qa/L0_sagemaker/test.sh\ was not run here (requires NVIDIA CI model artifacts / /opt/tritonserver). Please rely on pipeline for end-to-end verification.

Contributor checklist

Empty POST bodies and invalid JSON (e.g. SageMaker /invocations probes) were surfaced as INTERNAL and mapped to HTTP 500. Return INVALID_ARG for empty bodies when disallowed, and remap TritonJson parse failures to INVALID_ARG so clients get 400.

Add L0_sagemaker regression tests and bump UNIT_TEST_COUNT.

Fixes triton-inference-server#8762

Co-authored-by: Cursor <cursoragent@cursor.com>
@AffanBinFaisal
Copy link
Copy Markdown
Author

@yinggeh Kindly review my PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

SageMaker single-model endpoint returns 500 for empty-body POST to /invocations (should be 400)

3 participants