weaviate/weaviate · warning

/object ttl marshal response: err.Error()

Error message

/object ttl marshal response: err.Error()

What it means

In `ObjectTTL.incomingStatus`, the handler builds an `ObjectsExpiredStatusResponse` (a single bool field, `DeletionOngoing`) and JSON-encodes it directly into the ResponseWriter. If `json.NewEncoder(w).Encode` fails — typically because the client disconnected before/while the body was written — the handler attempts a second write with a 500 and the message `/object ttl marshal response: <err>`. Because the 200 status and headers were already sent, this error text usually cannot reach the caller and mainly surfaces in server logs.

Solutions

  1. Retry the status request; a transient write failure on a 2-line JSON body is almost always a connection problem, not a data problem.
  2. Check inter-node connectivity (pod liveness, network policies, keepalive settings) between the calling and responding cluster nodes.
  3. If reproducible with an always-connected client, capture the inner encoder error from server logs — the marshalable struct is trivially serializable, so the fault lies in the transport/writer.
Defensive patterns

Strategy: retry

Try / catch

try {
  const res = await fetch(statusUrl);
  const status = await res.json();
} catch (e) {
  if (attempt < maxRetries) return retryWithBackoff(attempt + 1);
  throw e;
}

Prevention

When it happens

Trigger: POST/GET to `/cluster/object_ttl/status` where the peer closes the connection mid-response, a network interruption between cluster nodes, or (rarely) an http.ResponseWriter implementation whose Encode/write path errors, e.g. a wrapped writer with a size-limited buffer.

Common situations: Flaky inter-node networking in Kubernetes pods; aggressive client timeouts shorter than the server's response time; node restarts during a rolling upgrade while another node polls TTL status.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/a4ffd6bf90be9898. Report an issue: GitHub.

Appendix: source

Thrown at adapters/handlers/rest/clusterapi/object_ttl.go:106

		default:
			http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
			return
		}
	}
}

func (d *ObjectTTL) incomingStatus() http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		defer r.Body.Close()

		status := objectttl.ObjectsExpiredStatusResponse{
			DeletionOngoing: d.localStatus.IsRunning(),
		}

		status.SetContentTypeHeader(w)
		w.WriteHeader(http.StatusOK)
		if err := json.NewEncoder(w).Encode(status); err != nil {
			http.Error(w, "/object ttl marshal response: "+err.Error(),
				http.StatusInternalServerError)
		}
	})
}

func (d *ObjectTTL) incomingDelete() http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		defer r.Body.Close()

		ok, ttlCtx := d.localStatus.SetRunning()
		if !ok {
			http.Error(w, "another request is still being processed", http.StatusTooManyRequests)
			return
		}

		var body []objectttl.ObjectsExpiredPayload
		if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
			d.localStatus.ResetRunning("bad request")

View on GitHub (pinned to 75aa4b6d11)