{"record":{"id":"448b76e84b890b4e","repo":"sipeed/picoclaw","slug":"deltachat-rpc-stdout-w","errorCode":null,"errorMessage":"deltachat rpc stdout: %w","messagePattern":"deltachat rpc stdout: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/deltachat/rpc.go","lineNumber":66,"sourceCode":"\tmu      sync.Mutex\n\tnextID  uint64\n\tpending map[uint64]chan rpcResponse\n\tclosed  bool\n}\n\n// startRPC spawns the RPC server with DC_ACCOUNTS_PATH pointing at dataDir and\n// begins the background read loop.\nfunc startRPC(serverPath, dataDir string) (*rpcClient, error) {\n\tcmd := exec.Command(serverPath)\n\tcmd.Env = append(cmd.Environ(), \"DC_ACCOUNTS_PATH=\"+dataDir)\n\n\tstdin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"deltachat rpc stdin: %w\", err)\n\t}\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"deltachat rpc stdout: %w\", err)\n\t}\n\t// Let the server's logs flow to our stderr for easy diagnostics.\n\tcmd.Stderr = logWriter{}\n\n\tif err := cmd.Start(); err != nil {\n\t\treturn nil, fmt.Errorf(\"start deltachat-rpc-server (%s): %w\", serverPath, err)\n\t}\n\n\tc := &rpcClient{\n\t\tcmd:     cmd,\n\t\tstdin:   stdin,\n\t\tstdout:  stdout,\n\t\tpending: make(map[uint64]chan rpcResponse),\n\t}\n\tgo c.readLoop()\n\treturn c, nil\n}\n","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/deltachat/rpc.go#L48-L84","documentation":"cmd.StdoutPipe() failed: same pipe-creation failure class as the stdin case, but for the response stream the readLoop would consume. The child has not started yet when this fires.","triggerScenarios":"Pipe(2) for stdout fails, most commonly fd exhaustion (EMFILE) at the ulimit ceiling.","commonSituations":"Same as the stdin case: fd leaks or low LimitNOFILE in containers/service units.","solutions":["Raise the open-file limit for the PicoClaw process","Inspect for descriptor leaks with lsof and fix them","Restart the process and retry channel start"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil { // returned from startRPC\n    if strings.Contains(err.Error(), \"rpc stdout\") {\n        // pipe-creation failure: raise fd limits / fix leaks, then retry start\n    }\n    return err\n}","preventionTips":["Raise the process open-file limit in containers and service units","Treat stdin/stdout pipe errors as environment problems, not transient ones: fix limits first"],"tags":["deltachat","rpc","os","resources","go"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}