weaviate/weaviate · error

marshal commit request: %w

Error message

marshal commit request: %w

What it means

json.Marshal failed while serializing the *backup.StatusRequest into the JSON body of the commit (two-phase commit finalize) message. Indicates the request struct contains values Go's JSON encoder cannot encode.

Source

Thrown at adapters/clients/cluster_backups.go:82

	}

	var resp backup.CanCommitResponse
	err = json.Unmarshal(respBody, &resp)
	if err != nil {
		return nil, fmt.Errorf("unmarshal can-commit response: %w", err)
	}

	return &resp, nil
}

func (c *ClusterBackups) Commit(ctx context.Context,
	host string, req *backup.StatusRequest,
) error {
	url := url.URL{Scheme: "http", Host: host, Path: pathCommit}

	b, err := json.Marshal(req)
	if err != nil {
		return fmt.Errorf("marshal commit request: %w", err)
	}

	httpReq, err := http.NewRequest(http.MethodPost, url.String(), bytes.NewReader(b))
	if err != nil {
		return fmt.Errorf("new commit request: %w", err)
	}

	respBody, statusCode, err := c.do(httpReq)
	if err != nil {
		return fmt.Errorf("commit request: %w", err)
	}

	if statusCode != http.StatusCreated {
		return fmt.Errorf("unexpected status code %d (%s)",
			statusCode, respBody)
	}

	return nil

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Inspect StatusRequest fields for non-serializable values
  2. Verify the request is constructed correctly by the coordinator before Commit
  3. Add logging around the request contents to find the offending field
Defensive patterns

Strategy: validation

Validate before calling

// Pre-validate the commit request serializes cleanly
if req == nil || req.ID == "" {
  return errors.New("commit request missing backup ID")
}
if _, err := json.Marshal(req); err != nil {
  return fmt.Errorf("invalid commit request: %w", err)
}

Try / catch

err := backups.Commit(ctx, host, req)
if err != nil && strings.Contains(err.Error(), "marshal commit request") {
  return fmt.Errorf("malformed commit payload: %w", err)
}

Prevention

When it happens

Trigger: backup.StatusRequest contains an unsupported type, cyclic reference, or a field whose MarshalJSON errors.

Common situations: Malformed backup ID/state propagated from the coordinator, upstream bug populating the request.

Understand the failure class

Background: json.Marshal / "failed to marshal" errors in Go: why "unsupported type" happens and how to fix it — this error's family across 22 libraries.

Related errors


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