probelabs/goreplay · info

http.StatusText(200)

Error message

http.StatusText(200)

What it means

HTTPInput.handler receives an inbound HTTP request, dumps it (including body) into the data channel, and responds with http.Error(w, http.StatusText(200), 200) — i.e. the literal text '200 OK' with status 200. This is not a failure: the message string is just the constant 'http.StatusText(200)'; it appears in logs/traces as the response body the input returns to senders.

Source

Thrown at input_http.go:54

	case buf := <-i.data:
		msg.Data = buf
		msg.Meta = payloadHeader(RequestPayload, uuid(), time.Now().UnixNano(), -1)
		return &msg, nil
	}
}

// Close closes this plugin
func (i *HTTPInput) Close() error {
	close(i.stop)
	return nil
}

func (i *HTTPInput) handler(w http.ResponseWriter, r *http.Request) {
	r.URL.Scheme = "http"
	r.URL.Host = i.address

	buf, _ := httputil.DumpRequestOut(r, true)
	http.Error(w, http.StatusText(200), 200)
	i.data <- buf
}

func (i *HTTPInput) listen(address string) {
	var err error

	mux := http.NewServeMux()

	mux.HandleFunc("/", i.handler)

	i.listener, err = net.Listen("tcp", address)
	if err != nil {
		log.Fatal("HTTP input listener failure:", err)
	}
	i.address = i.listener.Addr().String()

	go func() {
		err = http.Serve(i.listener, mux)

View on GitHub (pinned to 251e45abd2)

Solutions

  1. Treat a 200 status as success; the body is informational text, not an error.
  2. If a structured ack is needed, change the handler to w.WriteHeader(http.StatusOK) with your own body (e.g. JSON).
  3. Don't use http.Error for non-error responses; it forces the status text as body.

Example fix

// before
http.Error(w, http.StatusText(200), 200)
// after
w.WriteHeader(http.StatusOK)
w.Write([]byte("ok\n"))
Defensive patterns

Strategy: try-catch

Try / catch

resp, err := http.Post(inputURL, "application/json", body)
if err != nil { return err }
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
	b, _ := io.ReadAll(resp.Body)
	return fmt.Errorf("http input returned %d: %s", resp.StatusCode, b)
}
// 200 with body "200 OK" is the normal ack

Prevention

When it happens

Trigger: Any client POSTing an event to the HTTP input's listening address; the handler always replies with status 200 and body '200 OK'.

Common situations: Clients parsing the response body expecting JSON and seeing the plain text '200 OK'; confusion when monitoring shows body '200 OK'; misuse of http.Error for a success path (it sets the body to the status text).

Related errors


AI-assisted analysis of probelabs/goreplay@251e45abd2 (2026-09-02). Data as JSON: /api/errors/118947d4d23e2fcd. Report an issue: GitHub.