sipeed/picoclaw · error

deltachat get_all_accounts decode: %w

Error message

deltachat get_all_accounts decode: %w

What it means

The get_all_accounts result did not unmarshal into []dcAccount (id/kind/addr). A schema mismatch: the server returned something other than an array of objects with the expected field types.

Source

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

	}
	return accountConfigString(value)
}

func accountConfigOptionalInt(value int) *string {
	if value <= 0 {
		return nil
	}
	return accountConfigString(strconv.Itoa(value))
}

func (c *DeltaChatChannel) listAccounts(ctx context.Context) ([]dcAccount, error) {
	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 {

View on GitHub (pinned to 49183d7e8d)

Solutions

  1. Pin the deltachat-rpc-server version known to work with this PicoClaw release
  2. Dump the raw JSON to inspect the actual payload shape
  3. Report/adjust the dcAccount struct if the upstream schema legitimately changed
Defensive patterns

Strategy: try-catch

Try / catch

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

Prevention

When it happens

Trigger: json.Unmarshal(raw, &accounts) fails: the server returned an object envelope, a null, or fields with changed casing/types (e.g. id as string).

Common situations: Incompatible deltachat-rpc-server major version or a fork changing the accounts payload.

Related errors


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