{"record":{"id":"f56d62d91a1a472a","repo":"weaviate/weaviate","slug":"marshal-ids-w","errorCode":null,"errorMessage":"marshal ids: %w","messagePattern":"marshal ids: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"adapters/clients/replication.go","lineNumber":660,"sourceCode":"\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, fmt.Errorf(\"status code: %v, error: %s\", res.StatusCode, b)\n\t}\n\n\tvar resp []types.RepairResponse\n\tif err := json.NewDecoder(res.Body).Decode(&resp); err != nil {\n\t\treturn nil, fmt.Errorf(\"decode response: %w\", err)\n\t}\n\treturn resp, nil\n}\n\nfunc (c *replicationClient) FetchObjects(ctx context.Context, host,\n\tindex, shard string, ids []strfmt.UUID,\n) ([]replica.Replica, error) {\n\tresp := make(replica.Replicas, len(ids))\n\tidsBytes, err := json.Marshal(ids)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"marshal ids: %w\", err)\n\t}\n\n\tidsEncoded := base64.StdEncoding.EncodeToString(idsBytes)\n\n\treq, err := newHttpReplicaRequest(ctx, http.MethodGet, host, index, shard, \"\", \"\", nil, 0)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create http request: %w\", err)\n\t}\n\n\treq.URL.RawQuery = url.Values{\"ids\": []string{idsEncoded}}.Encode()\n\terr = c.doCustomUnmarshal(c.timeoutUnit*COMMIT_TIMEOUT_VALUE, req, nil, resp.UnmarshalBinary, MAX_RETRIES)\n\treturn resp, err\n}\n\nfunc (c *replicationClient) PutObject(ctx context.Context, host, index,\n\tshard, requestID string, obj *storobj.Object, schemaVersion uint64,\n) (replica.SimpleResponse, error) {\n\tvar resp replica.SimpleResponse","sourceCodeStart":642,"sourceCodeEnd":678,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/clients/replication.go#L642-L678","documentation":"FetchObjects marshals the []strfmt.UUID id list to JSON before base64-encoding it into the query string. Marshalling UUIDs is effectively infallible for valid input, so this error only fires with a malformed/nil-constructed id slice element (e.g. a custom MarshalJSON on the type failing).","triggerScenarios":"Passing a []strfmt.UUID containing a value whose JSON marshalling fails — practically only possible with corrupted UUID values or misuse of the strfmt type.","commonSituations":"Programmatic callers building the id list from unvalidated input; bugs upstream where non-UUID data was stored in the id slice.","solutions":["Validate each id with strfmt UUID parsing (uuid.Validate / IsUUID) before calling FetchObjects.","Trace where the id slice was built; find the element with invalid content.","Fix upstream producers to only append parsed strfmt.UUID values."],"exampleFix":"// before\nresp, err := client.FetchObjects(ctx, host, index, shard, ids)\n// after\nfor i, id := range ids {\n    if err := id.Validate(); err != nil {\n        return fmt.Errorf(\"invalid uuid at index %d: %w\", i, err)\n    }\n}\nresp, err := client.FetchObjects(ctx, host, index, shard, ids)","handlingStrategy":"validation","validationCode":"for i, id := range ids {\n    if id == \"\" || len(id) != 36 { return fmt.Errorf(\"invalid uuid at index %d\", i) }\n}","typeGuard":"func validUUIDs(ids []strfmt.UUID) bool {\n    for _, id := range ids {\n        if err := id.Validate(); err != nil { return false }\n    }\n    return true\n}","tryCatchPattern":"if !validUUIDs(ids) { return errors.New(\"id list contains invalid UUIDs\") }\nreplicas, err := client.FetchObjects(ctx, host, index, shard, ids)\nif err != nil { return err }","preventionTips":["Parse ids into strfmt.UUID at the boundary instead of casting strings.","Validate id slices before replication calls.","Unit-test id-producing code paths with invalid-input cases."],"tags":["serialization","json","uuid"],"backgroundTag":"request-encoding-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"}