sipeed/picoclaw · error

deltachat is_configured decode: %w

Error message

deltachat is_configured decode: %w

What it means

The is_configured result did not unmarshal into a JSON bool: the server returned 'true' as a string, a number, or another non-boolean shape. Pure schema mismatch, not an account state.

Source

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

	raw, err := c.rpc.call(ctx, "get_all_accounts")
	if err != nil {
		return nil, fmt.Errorf("deltachat get_all_accounts: %w", err)
	}
	var accounts []dcAccount
	if err := json.Unmarshal(raw, &accounts); err != nil {
		return nil, fmt.Errorf("deltachat get_all_accounts decode: %w", err)
	}
	return accounts, nil
}

func (c *DeltaChatChannel) isConfigured(ctx context.Context, accountID int64) (bool, error) {
	raw, err := c.rpc.call(ctx, "is_configured", accountID)
	if err != nil {
		return false, fmt.Errorf("deltachat is_configured: %w", err)
	}
	var ok bool
	if err := json.Unmarshal(raw, &ok); err != nil {
		return false, fmt.Errorf("deltachat is_configured decode: %w", err)
	}
	return ok, nil
}

// joinInviteLink optionally joins a chat via a configured invite/QR link.
func (c *DeltaChatChannel) joinInviteLink(ctx context.Context) error {
	link := strings.TrimSpace(c.config.InviteLink)
	if link == "" {
		return nil
	}
	chatRaw, err := c.rpc.call(ctx, "secure_join", c.accountID, link)
	if err != nil {
		return err
	}
	var chatID int64
	if err := json.Unmarshal(chatRaw, &chatID); err == nil && chatID > 0 {
		_, _ = c.rpc.call(ctx, "accept_chat", c.accountID, chatID)
		logger.InfoCF("deltachat", "Joined invite chat", map[string]any{"chat_id": chatID})

View on GitHub (pinned to 49183d7e8d)

Solutions

  1. Pin a compatible deltachat-rpc-server version
  2. Log the raw payload to confirm the shape
  3. Report upstream if a stock server produces it
Defensive patterns

Strategy: try-catch

Try / catch

var ok bool
if err := json.Unmarshal(raw, &ok); err != nil {
    logger.WarnCF("deltachat", "unexpected is_configured payload", map[string]any{"raw": string(raw)})
    return false, fmt.Errorf("deltachat is_configured decode: %w", err)
}

Prevention

When it happens

Trigger: json.Unmarshal(raw, &ok) fails on a non-boolean result payload.

Common situations: Version skew or a custom deltachat-rpc-server build encoding booleans differently.

Related errors


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/edee7b4a45da6d81. Report an issue: GitHub.