weaviate/weaviate · warning
marshal ids: %w
Error message
marshal ids: %w
What it means
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).
Source
Thrown at adapters/clients/replication.go:660
return nil, err
}
return nil, fmt.Errorf("status code: %v, error: %s", res.StatusCode, b)
}
var resp []types.RepairResponse
if err := json.NewDecoder(res.Body).Decode(&resp); err != nil {
return nil, fmt.Errorf("decode response: %w", err)
}
return resp, nil
}
func (c *replicationClient) FetchObjects(ctx context.Context, host,
index, shard string, ids []strfmt.UUID,
) ([]replica.Replica, error) {
resp := make(replica.Replicas, len(ids))
idsBytes, err := json.Marshal(ids)
if err != nil {
return nil, fmt.Errorf("marshal ids: %w", err)
}
idsEncoded := base64.StdEncoding.EncodeToString(idsBytes)
req, err := newHttpReplicaRequest(ctx, http.MethodGet, host, index, shard, "", "", nil, 0)
if err != nil {
return nil, fmt.Errorf("create http request: %w", err)
}
req.URL.RawQuery = url.Values{"ids": []string{idsEncoded}}.Encode()
err = c.doCustomUnmarshal(c.timeoutUnit*COMMIT_TIMEOUT_VALUE, req, nil, resp.UnmarshalBinary, MAX_RETRIES)
return resp, err
}
func (c *replicationClient) PutObject(ctx context.Context, host, index,
shard, requestID string, obj *storobj.Object, schemaVersion uint64,
) (replica.SimpleResponse, error) {
var resp replica.SimpleResponseView on GitHub (pinned to 75aa4b6d11)
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.
Example fix
// before
resp, err := client.FetchObjects(ctx, host, index, shard, ids)
// after
for i, id := range ids {
if err := id.Validate(); err != nil {
return fmt.Errorf("invalid uuid at index %d: %w", i, err)
}
}
resp, err := client.FetchObjects(ctx, host, index, shard, ids) Defensive patterns
Strategy: validation
Validate before calling
for i, id := range ids {
if id == "" || len(id) != 36 { return fmt.Errorf("invalid uuid at index %d", i) }
} Type guard
func validUUIDs(ids []strfmt.UUID) bool {
for _, id := range ids {
if err := id.Validate(); err != nil { return false }
}
return true
} Try / catch
if !validUUIDs(ids) { return errors.New("id list contains invalid UUIDs") }
replicas, err := client.FetchObjects(ctx, host, index, shard, ids)
if err != nil { return err } Prevention
- 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.
When it happens
Trigger: Passing a []strfmt.UUID containing a value whose JSON marshalling fails — practically only possible with corrupted UUID values or misuse of the strfmt type.
Common situations: Programmatic callers building the id list from unvalidated input; bugs upstream where non-UUID data was stored in the id slice.
Related errors
- marshal status request: %w
- marshal abort request: %w
- marshal prepare request: %w
- encode async-checkpoint create body: %w
- encode async-checkpoint delete body: %w
AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04).
Data as JSON: /api/errors/f56d62d91a1a472a.
Report an issue: GitHub.