{"record":{"id":"49e57f7f76c7b95a","repo":"sipeed/picoclaw","slug":"get-config-s-w","errorCode":null,"errorMessage":"get config %s: %w","messagePattern":"get config (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/deltachat/deltachat.go","lineNumber":1106,"sourceCode":"}\n\nfunc (c *DeltaChatChannel) cleanupPendingAccount(ctx context.Context, accountID int64) {\n\tif accountID <= 0 || c.rpc == nil {\n\t\treturn\n\t}\n\tstopCtx, cancel := context.WithTimeout(ctx, 10*time.Second)\n\t_, _ = c.rpc.call(stopCtx, \"stop_ongoing_process\", accountID)\n\tcancel()\n\n\tremoveCtx, cancel := context.WithTimeout(ctx, 10*time.Second)\n\t_, _ = c.rpc.call(removeCtx, \"remove_account\", accountID)\n\tcancel()\n}\n\nfunc (c *DeltaChatChannel) getAccountConfigString(ctx context.Context, accountID int64, key string) (string, error) {\n\traw, err := c.rpc.call(ctx, \"get_config\", accountID, key)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"get config %s: %w\", key, err)\n\t}\n\tvar value *string\n\tif err := json.Unmarshal(raw, &value); err != nil {\n\t\treturn \"\", fmt.Errorf(\"decode config %s: %w\", key, err)\n\t}\n\tif value == nil {\n\t\treturn \"\", nil\n\t}\n\treturn *value, nil\n}\n\nfunc (c *DeltaChatChannel) passwordRequiredError(reason string) error {\n\treturn fmt.Errorf(\"deltachat: account %s is not configured in data_dir %s (%s)\",\n\t\tc.config.Email, c.dataDir, reason)\n}\n\nfunc (c *DeltaChatChannel) applyProfileConfig(ctx context.Context, accountID int64) error {\n\tcfgMap := map[string]*string{}","sourceCodeStart":1088,"sourceCodeEnd":1124,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/deltachat/deltachat.go#L1088-L1124","documentation":"getAccountConfigString wraps a failed get_config JSON-RPC call. The wrapped error is one of: *rpcError (code+message from the server, format 'deltachat rpc error %d: %s'), 'deltachat rpc: connection closed', 'rpc closed: <cause>' (failAll after stdout EOF), or a context error.","triggerScenarios":"c.rpc.call(ctx, \"get_config\", accountID, key) fails: the RPC child process died, ctx was canceled, or the core rejected the account id / key.","commonSituations":"Stale accountID after an out-of-band remove_account; deltachat-rpc-server crash; shutdown race where the parent ctx is canceled first.","solutions":["Probe server liveness with get_system_info (2s timeout, as the ready-loop does)","Confirm the account still exists via get_all_accounts","Restart PicoClaw so the RPC child is respawned and ensureAccount re-runs"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Liveness probe before relying on get_config\nfunc rpcAlive(c *rpcClient) bool {\n    ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)\n    defer cancel()\n    _, err := c.call(ctx, \"get_system_info\")\n    return err == nil\n}","typeGuard":null,"tryCatchPattern":"addr, err := c.getAccountConfigString(ctx, id, key)\nif err != nil {\n    if strings.Contains(err.Error(), \"rpc closed\") || strings.Contains(err.Error(), \"connection closed\") {\n        // transport gone: respawn server / restart channel instead of retrying the call\n    }\n    return \"\", err\n}","preventionTips":["Probe get_system_info after any suspected server crash before reissuing config reads","Never cache accountIDs across remove_account operations"],"tags":["deltachat","rpc","config","go"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}