rqlite/rqlite · error

server responded with %s

Error message

server responded with %s

What it means

The 'reap' command POSTs to /reap and expects HTTP 200. Any other status (apart from 401, handled earlier) produces this error carrying the HTTP status line. Unlike the leader command, the response body is not included — only the status string (e.g. '503 Service Unavailable').

Source

Thrown at cmd/rqlite/main.go:566

func expvar(ctx *cli.Context, client *httpcl.Client, line string) error {
	u := fmt.Sprintf("%sdebug/vars", client.Prefix)
	return cliJSON(ctx, client, line, u)
}

func reap(ctx *cli.Context, client *httpcl.Client) error {
	u := fmt.Sprintf("%sreap", client.Prefix)
	resp, err := client.Post(u, nil)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

	if resp.StatusCode == http.StatusUnauthorized {
		return fmt.Errorf("unauthorized")
	}
	if resp.StatusCode != http.StatusOK {
		return fmt.Errorf("server responded with %s", resp.Status)
	}

	var result map[string]int
	if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
		return fmt.Errorf("failed to decode response: %s", err)
	}
	ctx.String("snapshots reaped: %d, WALs checkpointed: %d\n",
		result["snapshots_reaped"], result["wals_checkpointed"])
	return nil
}

func snapshot(client *httpcl.Client, trailingLogs int) error {
	u := fmt.Sprintf("%ssnapshot?trailing_logs=%d", client.Prefix, trailingLogs)
	resp, err := client.Post(u, nil)
	if err != nil {
		return err
	}
	defer resp.Body.Close()

View on GitHub (pinned to 7586a4d1bd)

Solutions

  1. Check the HTTP status in the message to identify the failure kind (404 vs 5xx).
  2. Upgrade rqlited if /reap is unsupported in your version.
  3. Curl the endpoint directly to see the response body/details.
  4. Check rqlited logs for the server-side error accompanying a 5xx.

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

resp, err := client.Post(u, nil)
if err != nil { return err }
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusUnauthorized {
    return fmt.Errorf("/reap not available (HTTP %d) — check rqlited version", resp.StatusCode)
}

Type guard

null

Try / catch

if err := reap(ctx, client); err != nil {
    if strings.Contains(err.Error(), "server responded with 404") {
        return fmt.Errorf("/reap unsupported on this rqlited version; upgrade")
    }
    return err
}

Prevention

When it happens

Trigger: POST /reap returns a non-200/401 status — e.g. 404 on an rqlited version without the reap endpoint, 405 if routed through a misconfigured proxy, or 5xx while the node is busy or unhealthy.

Common situations: Older rqlited binary lacking the /reap endpoint; reverse proxy blocking POST; node overloaded or returning 500 during snapshot/checkpoint work.

Related errors


AI-assisted analysis of rqlite/rqlite@7586a4d1bd (2026-09-03). Data as JSON: /api/errors/e4731e8a049e02fd. Report an issue: GitHub.