sipeed/picoclaw · error

deltachat get_all_accounts

Error message

deltachat get_all_accounts: %w

What it means

listAccounts' get_all_accounts JSON-RPC call failed at the transport level: server error, closed stdio ('deltachat rpc: connection closed' / 'rpc closed: ...'), or canceled context. It runs at the top of ensureAccount, so this usually means the RPC child is unhealthy.

Solutions

  1. Check the server's stderr in PicoClaw debug logs for its exit reason
  2. Verify data_dir exists and is writable by the service user
  3. Restart PicoClaw so startRPC respawns the child
Defensive patterns

Strategy: try-catch

Try / catch

accounts, err := c.listAccounts(ctx)
if err != nil {
    if strings.Contains(err.Error(), "rpc closed") || strings.Contains(err.Error(), "connection closed") {
        // child is dead: restart channel to respawn deltachat-rpc-server
    }
    return nil, err
}

Prevention

When it happens

Trigger: c.rpc.call(ctx, "get_all_accounts") errors because the child died at startup or the ctx is already canceled.

Common situations: deltachat-rpc-server exiting immediately (unreadable DC_ACCOUNTS_PATH, bad arch binary starting then crashing), PicoClaw shutting down.

Related errors


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

Appendix: source

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

func accountConfigOptionalString(value string) *string {
	if value == "" {
		return nil
	}
	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

View on GitHub (pinned to 49183d7e8d)