sipeed/picoclaw · error
search contacts decode
Error message
search contacts decode: %w
What it means
Raised by findMatchingContacts when the JSON returned by the 'get_contacts' RPC cannot be unmarshaled into []dcContact, meaning the RPC server returned an unexpected payload shape or version mismatch.
Solutions
- Verify the deltachat-rpc-server version matches the expected get_contacts JSON schema
- Log the raw response payload to inspect the unexpected shape
- Return an empty match set or a clear recipient-lookup failure instead of crashing resolution
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at pkg/channels/deltachat/deltachat.go:732 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/995bd285de19abe8.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/channels/deltachat/deltachat.go:732
}
key := strings.ToLower(value)
if _, ok := seen[key]; ok {
continue
}
seen[key] = struct{}{}
out = append(out, value)
}
return out
}
func (c *DeltaChatChannel) findMatchingContacts(ctx context.Context, query string) ([]dcContact, error) {
raw, err := c.rpc.call(ctx, "get_contacts", c.accountID, 0, query)
if err != nil {
return nil, fmt.Errorf("search contacts: %w", err)
}
var contacts []dcContact
if err := json.Unmarshal(raw, &contacts); err != nil {
return nil, fmt.Errorf("search contacts decode: %w", err)
}
contacts = uniqueContacts(contacts)
if exact := exactContactMatches(query, contacts); len(exact) > 0 {
return exact, nil
}
if len(contacts) == 1 {
return contacts, nil
}
return nil, nil
}
func uniqueContacts(contacts []dcContact) []dcContact {
seen := make(map[int64]struct{}, len(contacts))
out := make([]dcContact, 0, len(contacts))
for _, contact := range contacts {
if contact.ID <= 0 {
continue
}View on GitHub (pinned to 49183d7e8d)