sipeed/picoclaw · error

deltachat add_account decode

Error message

deltachat add_account decode: %w

What it means

Fired when the add_account RPC succeeded but its JSON response could not be decoded into an int64 account ID. Indicates the Delta Chat core returned an unexpected payload for account creation, so the channel cannot proceed with configuring the new account.

Solutions

  1. Log the raw response payload to see what the server returned
  2. Check deltachat-rpc-server version compatibility
  3. Fail setup with a clear decode error; retrying without fixing the payload will not help
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/channels/deltachat/deltachat.go:989 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/862c6ab7d75c26d4. Report an issue: GitHub.

Appendix: source

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

	var accountID int64
	for _, acc := range accounts {
		if acc.Kind == "Configured" && strings.EqualFold(acc.Addr, c.config.Email) {
			accountID = acc.ID
			break
		}
	}

	if accountID == 0 {
		if c.config.Password.String() == "" {
			return c.passwordRequiredError("account not found")
		}

		raw, callErr := c.rpc.call(ctx, "add_account")
		if callErr != nil {
			return fmt.Errorf("deltachat add_account: %w", callErr)
		}
		if decErr := json.Unmarshal(raw, &accountID); decErr != nil {
			return fmt.Errorf("deltachat add_account decode: %w", decErr)
		}
	}

	configured, err := c.isConfigured(ctx, accountID)
	if err != nil {
		return err
	}
	if !configured {
		if err := c.configureAccount(ctx, accountID); err != nil {
			return err
		}
	} else if c.config.Password.String() != "" {
		changed, err := c.accountConfigChanged(ctx, accountID)
		if err != nil {
			logger.WarnCF("deltachat", "Could not read account config; reconfiguring", map[string]any{
				"email": c.config.Email,
				"error": err.Error(),
			})

View on GitHub (pinned to 49183d7e8d)