sipeed/picoclaw · error

deltachat rpc stdout: %w

Error message

deltachat rpc stdout: %w

What it means

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.

Source

Thrown at pkg/channels/deltachat/rpc.go:66

	mu      sync.Mutex
	nextID  uint64
	pending map[uint64]chan rpcResponse
	closed  bool
}

// startRPC spawns the RPC server with DC_ACCOUNTS_PATH pointing at dataDir and
// begins the background read loop.
func startRPC(serverPath, dataDir string) (*rpcClient, error) {
	cmd := exec.Command(serverPath)
	cmd.Env = append(cmd.Environ(), "DC_ACCOUNTS_PATH="+dataDir)

	stdin, err := cmd.StdinPipe()
	if err != nil {
		return nil, fmt.Errorf("deltachat rpc stdin: %w", err)
	}
	stdout, err := cmd.StdoutPipe()
	if err != nil {
		return nil, fmt.Errorf("deltachat rpc stdout: %w", err)
	}
	// Let the server's logs flow to our stderr for easy diagnostics.
	cmd.Stderr = logWriter{}

	if err := cmd.Start(); err != nil {
		return nil, fmt.Errorf("start deltachat-rpc-server (%s): %w", serverPath, err)
	}

	c := &rpcClient{
		cmd:     cmd,
		stdin:   stdin,
		stdout:  stdout,
		pending: make(map[uint64]chan rpcResponse),
	}
	go c.readLoop()
	return c, nil
}

View on GitHub (pinned to 49183d7e8d)

Solutions

  1. Raise the open-file limit for the PicoClaw process
  2. Inspect for descriptor leaks with lsof and fix them
  3. Restart the process and retry channel start
Defensive patterns

Strategy: try-catch

Try / catch

if err != nil { // returned from startRPC
    if strings.Contains(err.Error(), "rpc stdout") {
        // pipe-creation failure: raise fd limits / fix leaks, then retry start
    }
    return err
}

Prevention

When it happens

Trigger: Pipe(2) for stdout fails, most commonly fd exhaustion (EMFILE) at the ulimit ceiling.

Common situations: Same as the stdin case: fd leaks or low LimitNOFILE in containers/service units.

Related errors


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