weaviate/weaviate · error
marshal filter: %w
Error message
marshal filter: %w
What it means
FindUUIDs JSON-serializes the optional property filter before sending the FindUUIDs gRPC request; a marshaling failure is wrapped as 'marshal filter'. The filter is a schema-backed property filter structure, so this means the filter object could not be converted to JSON — an internal inconsistency rather than a remote problem.
Source
Thrown at adapters/clients/replication_grpc.go:599
return nil, fmt.Errorf("gRPC OverwriteObjects: %w", err)
}
return protoToRepairResponses(resp.GetResults()), nil
}
func (c *grpcReplicationClient) FindUUIDs(ctx context.Context, host, index, shard string,
filter *filters.LocalFilter, limit int,
) ([]strfmt.UUID, error) {
client, err := c.getClient(host)
if err != nil {
return nil, err
}
var filterJSON []byte
if filter != nil {
filterJSON, err = json.Marshal(filter)
if err != nil {
return nil, fmt.Errorf("marshal filter: %w", err)
}
}
// No explicit timeout — relies on caller's context deadline, matching REST behavior.
// Disable retries to match REST behavior, which had no retries for FindUUIDs.
resp, err := client.FindUUIDs(ctx, &protocol.FindUUIDsRequest{
Index: index,
Shard: shard,
FilterJson: filterJSON,
Limit: int32(limit),
}, grpc_retry.Disable())
if err != nil {
return nil, fmt.Errorf("gRPC FindUUIDs: %w", err)
}
return clusterapi.StringsToUUIDs(resp.GetUuids()), nil
}
View on GitHub (pinned to 75aa4b6d11)
Solutions
- Ensure the filter is built through the standard filter API rather than raw structs
- Validate the filter serializes on its own (json.Marshal in a test) before calling FindUUIDs
- Check for version mismatches between the code constructing the filter and the client library
- Fall back to a nil filter (scan without filter) to unblock while fixing the filter construction
Example fix
// before
filter := &Filter{Where: weirdStruct} // cannot marshal
uuids, err := client.FindUUIDs(ctx, host, index, shard, filter, limit)
// after
if b, merr := json.Marshal(filter); merr != nil {
filter = nil // or rebuild a valid filter
}
uuids, err := client.FindUUIDs(ctx, host, index, shard, filter, limit) Defensive patterns
Strategy: validation
Validate before calling
// Verify the filter serializes before the RPC:
if filter != nil {
if _, err := json.Marshal(filter); err != nil {
return nil, fmt.Errorf("invalid filter: %w", err)
}
} Type guard
func isValidFilter(f *Filter) bool {
if f == nil { return true }
_, err := json.Marshal(f)
return err == nil
} Try / catch
uuids, err := client.FindUUIDs(ctx, host, index, shard, filter, limit)
if err != nil && strings.Contains(err.Error(), "marshal filter") {
return nil, fmt.Errorf("rejecting request: filter cannot be serialized: %w", err)
} Prevention
- Build filters only via the standard filter API, never ad-hoc structs
- Add a serialization round-trip test for every filter shape you use
- Snapshot-test filter JSON output when upgrading filter schema versions
When it happens
Trigger: Calling FindUUIDs with a non-nil filter whose structure cannot be JSON-marshaled, e.g. containing unsupported types (channels, funcs, cyclic structures) or a programmatically built filter violating the filter schema.
Common situations: Custom tooling constructing filters programmatically with invalid types; upstream bugs in filter construction; mixing filter versions after an upgrade where the filter struct changed.
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
- 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/7d6cf30f70f8b151.
Report an issue: GitHub.