sipeed/picoclaw · error

ambiguous recipient matches

Error message

ambiguous recipient %q matches %s: %w

What it means

Constructed by ambiguousRecipientError when a recipient query matches more than one chat/contact. It is a deliberate validation error wrapping the list of matching labels so the caller can prompt the user to disambiguate.

Solutions

  1. Surface the matched labels to the user and ask them to pick a more specific name or address
  2. Encourage use of full email addresses to avoid ambiguous matches
  3. No retry is useful; the input itself must change
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/channels/deltachat/deltachat.go:860 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/9ecaa4e22bed5b4a. Report an issue: GitHub.

Appendix: source

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

		}
	}
	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 == "" {
			name = strings.TrimSpace(contact.Name)
		}
		if name != "" && contact.Address != "" {
			labels = append(labels, fmt.Sprintf("%s <%s>", name, contact.Address))
		} else if contact.Address != "" {
			labels = append(labels, contact.Address)

View on GitHub (pinned to 49183d7e8d)