{"record":{"id":"738557c2411fb5de","repo":"wavetermdev/waveterm","slug":"failed-to-create-stdin-pipe-w-738557","errorCode":null,"errorMessage":"failed to create stdin pipe: %w","messagePattern":"failed to create stdin pipe: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/buildercontroller/buildercontroller.go","lineNumber":350,"sourceCode":"\t}\n\n\tfor key, value := range builderEnv {\n\t\tcmd.Env = append(cmd.Env, key+\"=\"+value)\n\t}\n\n\tstdoutPipe, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create stdout pipe: %w\", err)\n\t}\n\n\tstderrPipe, err := cmd.StderrPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create stderr pipe: %w\", err)\n\t}\n\n\tstdinPipe, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create stdin pipe: %w\", err)\n\t}\n\n\tportChan := make(chan int, 1)\n\tportFound := false\n\n\tbc.outputBuffer.SetLineCallback(func(line string) {\n\t\tif !portFound {\n\t\t\tif port := build.ParseTsunamiPort(line); port > 0 {\n\t\t\t\tportFound = true\n\t\t\t\tportChan <- port\n\t\t\t}\n\t\t}\n\t\tbc.publishOutputLine(line, false)\n\t})\n\n\terr = cmd.Start()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to start process: %w\", err)","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/buildercontroller/buildercontroller.go#L332-L368","documentation":"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).","triggerScenarios":"cmd.StdinPipe() returns non-nil err — Cmd already started, or OS pipe allocation failure.","commonSituations":"fd exhaustion on busy hosts; accidental double invocation of Start(); running inside containers with very low fd limits.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"process, err := bc.runBuilderApp(ctx, ...)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to create stdin pipe\") {\n        return fmt.Errorf(\"builder pipe setup failed: %w\", err)\n    }\n    return err\n}","preventionTips":["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"],"tags":["go","os-exec","subprocess","pipe"],"backgroundTag":"os-exec-pipe-creation-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}