{"record":{"id":"a242ed693b0c7155","repo":"weaviate/weaviate","slug":"marshal-commit-request-w","errorCode":null,"errorMessage":"marshal commit request: %w","messagePattern":"marshal commit request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/clients/cluster_backups.go","lineNumber":82,"sourceCode":"\t}\n\n\tvar resp backup.CanCommitResponse\n\terr = json.Unmarshal(respBody, &resp)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshal can-commit response: %w\", err)\n\t}\n\n\treturn &resp, nil\n}\n\nfunc (c *ClusterBackups) Commit(ctx context.Context,\n\thost string, req *backup.StatusRequest,\n) error {\n\turl := url.URL{Scheme: \"http\", Host: host, Path: pathCommit}\n\n\tb, err := json.Marshal(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"marshal commit request: %w\", err)\n\t}\n\n\thttpReq, err := http.NewRequest(http.MethodPost, url.String(), bytes.NewReader(b))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"new commit request: %w\", err)\n\t}\n\n\trespBody, statusCode, err := c.do(httpReq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"commit request: %w\", err)\n\t}\n\n\tif statusCode != http.StatusCreated {\n\t\treturn fmt.Errorf(\"unexpected status code %d (%s)\",\n\t\t\tstatusCode, respBody)\n\t}\n\n\treturn nil","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/clients/cluster_backups.go#L64-L100","documentation":"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.","triggerScenarios":"backup.StatusRequest contains an unsupported type, cyclic reference, or a field whose MarshalJSON errors.","commonSituations":"Malformed backup ID/state propagated from the coordinator, upstream bug populating the request.","solutions":["Inspect StatusRequest fields for non-serializable values","Verify the request is constructed correctly by the coordinator before Commit","Add logging around the request contents to find the offending field"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-validate the commit request serializes cleanly\nif req == nil || req.ID == \"\" {\n  return errors.New(\"commit request missing backup ID\")\n}\nif _, err := json.Marshal(req); err != nil {\n  return fmt.Errorf(\"invalid commit request: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"err := backups.Commit(ctx, host, req)\nif err != nil && strings.Contains(err.Error(), \"marshal commit request\") {\n  return fmt.Errorf(\"malformed commit payload: %w\", err)\n}","preventionTips":["Populate StatusRequest via validated constructors","Constrain backup IDs to JSON-safe characters","Cover backup request marshaling in unit tests"],"tags":["json","marshal","backup"],"backgroundTag":"json-marshal-failed","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}