{"record":{"id":"1f9ec58a462eb6c4","repo":"sipeed/picoclaw","slug":"deltachat-create-chatmail-account-on-s-w","errorCode":null,"errorMessage":"deltachat create chatmail account on %s: %w","messagePattern":"deltachat create chatmail account on (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/deltachat/deltachat.go","lineNumber":1060,"sourceCode":"\t\treturn fmt.Errorf(\"deltachat add_account decode: %w\", decodeErr)\n\t}\n\n\tcreated := false\n\tdefer func() {\n\t\tif !created {\n\t\t\tc.cleanupPendingAccount(context.Background(), accountID)\n\t\t}\n\t}()\n\n\tconfCtx, cancel := context.WithTimeout(ctx, configureTimeout)\n\tdefer cancel()\n\tif _, callErr := c.rpc.call(\n\t\tconfCtx,\n\t\t\"add_transport_from_qr\",\n\t\taccountID,\n\t\tbuildChatmailAccountQR(server),\n\t); callErr != nil {\n\t\treturn fmt.Errorf(\"deltachat create chatmail account on %s: %w\", server, callErr)\n\t}\n\tcreated = true\n\n\tif profileErr := c.applyProfileConfig(ctx, accountID); profileErr != nil {\n\t\tlogger.WarnCF(\n\t\t\t\"deltachat\",\n\t\t\t\"Could not apply profile config to new account\",\n\t\t\tmap[string]any{\"error\": profileErr.Error()},\n\t\t)\n\t}\n\n\taddr, err := c.getAccountConfigString(ctx, accountID, \"addr\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"deltachat created account on %s, but could not read generated email: %w\", server, err)\n\t}\n\taddr = strings.TrimSpace(addr)\n\tif addr == \"\" {\n\t\treturn fmt.Errorf(\"deltachat created account on %s, but generated email is empty\", server)","sourceCodeStart":1042,"sourceCodeEnd":1078,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/deltachat/deltachat.go#L1042-L1078","documentation":"Thrown by createChatmailBootstrapAccount when the JSON-RPC call add_transport_from_qr fails. This call passes a DCACCOUNT QR (built by buildChatmailAccountQR) to the spawned deltachat-rpc-server, which registers a brand-new account on the chatmail server over the network. It runs under configureTimeout (90s, deltachat.go:38); unless created=true, the deferred cleanupPendingAccount removes the half-created account, so retries are safe.","triggerScenarios":"channel_list.deltachat.settings.email contains the '@server' bootstrap marker (parseDeltaChatEmailSetting -> bootstrap=true) and then: the chatmail domain is wrong/unreachable, the server rejects registration, deltachat-rpc-server returns a JSON-RPC error object, the child process dies (readLoop EOF -> failAll -> 'rpc closed: ...'), or the 90s confCtx deadline expires.","commonSituations":"Typo'd chatmail domain (e.g. @nine.testrun.or), sandboxed host without egress to the chatmail server, an outdated deltachat-rpc-server build that lacks add_transport_from_qr, a slow server exceeding 90s, or DC_ACCOUNTS_PATH on a read-only/full volume making the child crash mid-registration.","solutions":["Check the deltachat-rpc-server stderr output (forwarded to debug logs via logWriter) for the core's real reason","Verify the domain is a real chatmail instance and egress to it (HTTPS/IMAP/SMTP) is allowed from this host","Upgrade deltachat-rpc-server to a release that supports add_transport_from_qr, then retry","Simply retry the run: the failure path already removed the pending account, so state is clean","If the error wraps context.DeadlineExceeded, raise configureTimeout (deltachat.go:38) or fix the slow network path"],"exampleFix":"// before (deltachat.go:38)\nconst configureTimeout = 90 * time.Second\n\n// after\nconst configureTimeout = 180 * time.Second","handlingStrategy":"retry","validationCode":"// Pre-flight: can we reach the chatmail server before bootstrapping?\nfunc chatmailReachable(server string) bool {\n    conn, err := net.DialTimeout(\"tcp\", net.JoinHostPort(server, \"443\"), 5*time.Second)\n    if err != nil {\n        return false\n    }\n    _ = conn.Close()\n    return true\n}","typeGuard":"func isRPCGone(err error) bool {\n    return errors.Is(err, context.DeadlineExceeded) ||\n        strings.Contains(err.Error(), \"rpc closed\") ||\n        strings.Contains(err.Error(), \"connection closed\")\n}","tryCatchPattern":"if err := ch.ensureAccount(ctx); err != nil {\n    if errors.Is(err, context.DeadlineExceeded) {\n        // network-bound registration timed out; retry is safe (pending account was cleaned up)\n    }\n    return err\n}","preventionTips":["Validate the chatmail domain and open egress before starting a bootstrap","Keep deltachat-rpc-server updated so add_transport_from_qr exists","Watch the debug logs (server stderr is forwarded there) during first registration"],"tags":["deltachat","chatmail","rpc","network","bootstrap","go"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}