﻿# Keep empty HTTP success separate from an empty generation

Validate the promised generation structure; a no-content HTTP success is different from a valid empty-text result.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-http-204-empty/
Language: en

An application receives a successful empty HTTP response and displays an empty assistant message. Its request may have reached a maintenance endpoint, a proxy shortcut or a route with different semantics from generation. Distinguish an HTTP response that intentionally has no content from a valid model response whose generated text happens to be empty.

## Identify the operation before the parser

Read the request method, target route and final status together. A no-content success can be appropriate for an operation that updates state without returning a representation. It is not automatically a valid response to a generation API that promises a result document. Check the endpoint's own contract. If generation requires a completion object or final event, absence of that structure is meaningful even when the transport status belongs to the success class.

## Apply the no-body framing rule

An intentional no-content status has specific framing semantics. The client must not wait for a response body that cannot be present under those rules. At the same time, application code must not fabricate a generation result from that transport success. Keep transport parsing and API validation as separate stages. A connection can be reusable and correctly framed while its response is incompatible with the operation the application intended to call.

## Separate empty text from absent result

A model response can contain no visible prose while still supplying tool calls, refusal information, finish metadata or another structured result. Parse those fields according to the API schema before deciding that nothing happened. Conversely, a bare empty HTTP response supplies none of that evidence. Do not infer successful model execution, token accounting or a normal stop reason from the absence of bytes. Preserve the raw status classification in error diagnostics.

## Trace the route that answered

Use a synthetic request and correlate gateway and application logs. Verify the configured base URL, path rewriting and method mapping. A health route or an OPTIONS handler accidentally selected by a proxy can produce a quick successful response without model admission. Compare the public route with an authorized internal test path, where available. Keep credentials redacted, and avoid adding repeated real prompts while the routing identity remains uncertain.

## Define the application's response policy

For a generation operation that requires a result representation, treat an unexpected no-content response as a contract failure with a clear explanation. Do not repeatedly retry without considering whether the original operation might have been admitted. Test a genuine empty-text model result, a structured non-prose result and an unexpected no-content transport response. Acceptance means the application keeps these cases distinct, finishes reading correctly and never labels an absent result as verified generation. This is a protocol and schema check, not a judgment about the usefulness or quality of a model's chosen answer.

## Primary references

[HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110.html). Defines no-content status semantics and response meaning.

[HTTP/1.1](https://www.rfc-editor.org/rfc/rfc9112.html). Defines when a response body is absent and how message boundaries are determined.

[Problem Details for HTTP APIs](https://www.rfc-editor.org/rfc/rfc9457.html). Supports a clear application error when the received response violates the expected API contract.

Related reading: [Golden inference API fixtures: test the contract rather than prose](/journal/provider-golden-contract-fixtures/); [Unsupported inference parameters: rejection, ignoring and the contract](/journal/provider-unsupported-parameter-policy/).
