wavetermdev/waveterm · error
failed to create stdin pipe: %w
Error message
failed to create stdin pipe: %w
What it means
runBuilderApp calls cmd.StdinPipe() to get a writable pipe for feeding the builder subprocess, and the exec package failed. As with the other pipes, this happens only if Start() already ran or the OS could not allocate a pipe (fd exhaustion).
Source
Thrown at pkg/buildercontroller/buildercontroller.go:350
}
for key, value := range builderEnv {
cmd.Env = append(cmd.Env, key+"="+value)
}
stdoutPipe, err := cmd.StdoutPipe()
if err != nil {
return nil, fmt.Errorf("failed to create stdout pipe: %w", err)
}
stderrPipe, err := cmd.StderrPipe()
if err != nil {
return nil, fmt.Errorf("failed to create stderr pipe: %w", err)
}
stdinPipe, err := cmd.StdinPipe()
if err != nil {
return nil, fmt.Errorf("failed to create stdin pipe: %w", err)
}
portChan := make(chan int, 1)
portFound := false
bc.outputBuffer.SetLineCallback(func(line string) {
if !portFound {
if port := build.ParseTsunamiPort(line); port > 0 {
portFound = true
portChan <- port
}
}
bc.publishOutputLine(line, false)
})
err = cmd.Start()
if err != nil {
return nil, fmt.Errorf("failed to start process: %w", err)View on GitHub (pinned to a4447c1563)
Solutions
- Order pipe creation (stdout, stderr, stdin) before cmd.Start()
- Check wrapped error for EMFILE/ENFILE and address fd leaks or ulimits
- Retry the build after resources are released
Defensive patterns
Strategy: try-catch
Try / catch
process, err := bc.runBuilderApp(ctx, ...)
if err != nil {
if strings.Contains(err.Error(), "failed to create stdin pipe") {
return fmt.Errorf("builder pipe setup failed: %w", err)
}
return err
} Prevention
- Keep pipe creation ordered and strictly pre-Start
- Avoid running Wave in containers with artificially low fd limits
- Log wrapped causes (%w) to distinguish double-start from fd exhaustion
When it happens
Trigger: cmd.StdinPipe() returns non-nil err — Cmd already started, or OS pipe allocation failure.
Common situations: fd exhaustion on busy hosts; accidental double invocation of Start(); running inside containers with very low fd limits.
Related errors
- failed to create stdout pipe: %w
- failed to create stderr pipe: %w
- failed to start process: %w
- process died before emitting port
- timeout waiting for port
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/738557c2411fb5de.
Report an issue: GitHub.