sipeed/picoclaw · error

get chat decode

Error message

get chat %d decode: %w

What it means

Fired in getFullChatByContext when the JSON response from the get_full_chat_by_id RPC cannot be unmarshalled into a dcChat struct. Means the Delta Chat core returned a payload that does not match the expected chat schema for chatID, so callers such as findMatchingChats cannot build the full chat record.

Solutions

  1. Log the raw response to inspect the unexpected JSON shape
  2. Verify deltachat-rpc-server schema compatibility
  3. Fail resolution with a descriptive decode error instead of using a partially populated chat
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/channels/deltachat/deltachat.go:854 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/27d4f7e67a6693fa. Report an issue: GitHub.

Appendix: source

Thrown at pkg/channels/deltachat/deltachat.go:854

func exactChatMatches(query string, chats []dcChat) []dcChat {
	var matches []dcChat
	for _, chat := range chats {
		if strings.EqualFold(strings.TrimSpace(chat.Name), strings.TrimSpace(query)) {
			matches = append(matches, chat)
		}
	}
	return matches
}

func (c *DeltaChatChannel) getFullChatByContext(ctx context.Context, chatID int64) (*dcChat, error) {
	raw, err := c.rpc.call(ctx, "get_full_chat_by_id", c.accountID, chatID)
	if err != nil {
		return nil, fmt.Errorf("get chat %d: %w", chatID, err)
	}
	var chat dcChat
	if err := json.Unmarshal(raw, &chat); err != nil {
		return nil, fmt.Errorf("get chat %d decode: %w", chatID, err)
	}
	return &chat, nil
}

func ambiguousRecipientError(target string, labels []string) error {
	return fmt.Errorf(
		"ambiguous recipient %q matches %s: %w",
		target,
		strings.Join(labels, ", "),
		channels.ErrSendFailed,
	)
}

func contactRecipientLabels(contacts []dcContact) []string {
	labels := make([]string, 0, len(contacts))
	for _, contact := range contacts {
		name := strings.TrimSpace(contact.DisplayName)
		if name == "" {

View on GitHub (pinned to 49183d7e8d)