{"record":{"id":"fff7d681c53a1c18","repo":"dagger/dagger","slug":"failed-to-start-session-subprocess-w","errorCode":null,"errorMessage":"failed to start session subprocess: %w","messagePattern":"failed to start session subprocess: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"cmd/init/main.go","lineNumber":227,"sourceCode":"\tr, w, err := os.Pipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// start the session subprocess\n\tcmd := exec.Command(\"/proc/self/exe\")\n\n\t// forwarding our stdio ensures that a panic in the child process won't get hidden and any other logging works too\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\n\tcmd.ExtraFiles = []*os.File{w}\n\tcmd.SysProcAttr = &syscall.SysProcAttr{\n\t\tSetsid: true,\n\t}\n\terr = cmd.Start()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to start session subprocess: %w\", err)\n\t}\n\n\t// wait for the session attachables to be ready (or the child to die)\n\n\t// need to close our dup of the write end of the pipe\n\tif err := w.Close(); err != nil {\n\t\treturn fmt.Errorf(\"failed to close pipe: %w\", err)\n\t}\n\n\tdoneCh := make(chan struct{})\n\tgo func() {\n\t\tdefer close(doneCh)\n\t\tio.Copy(io.Discard, r)\n\t}()\n\t// something really really wrong would have to happen for this to block indefinitely, but be\n\t// cautious anyways w/ an overly generous timeout\n\tselect {\n\tcase <-doneCh:","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/cmd/init/main.go#L209-L245","documentation":"startSessionSubprocess (cmd/init, running inside the engine init process) forks a detached session subprocess (Setsid) with a pipe for readiness signaling. This error wraps any failure from cmd.Start() — the OS refused to spawn the child process. The wrapped error carries the underlying syscall reason.","triggerScenarios":"mainInit -> startSessionSubprocess calls cmd.Start() and the exec fails: binary not found (ENOENT), not executable (EACCES), fork/resource limits hit (EAGAIN), or out of memory.","commonSituations":"Session binary missing or corrupted in the container image; wrong executable path; seccomp/AppArmor or PID namespace restrictions blocking exec; hitting process limits (ulimit -u) under heavy load.","solutions":["Read the wrapped %w error to identify the syscall cause (ENOENT/EACCES/EAGAIN)","Verify the session subprocess binary exists and is executable at the configured path","Check container security profiles (seccomp, AppArmor) and ulimits permit spawning the process","Free memory / raise process limits (nproc) if EAGAIN or OOM is reported","Restart the engine/pod if a transient resource exhaustion caused the fork failure"],"exampleFix":"// before: image stripped of the session binary -> ENOENT\n// after: ensure the binary ships and is executable\n//   Dockerfile: COPY --from=build /out/dagger-session /usr/local/bin/dagger-session\n//   RUN chmod +x /usr/local/bin/dagger-session","handlingStrategy":"try-catch","validationCode":"// pre-flight: ensure the session binary is present and executable\nif fi, err := os.Stat(sessionBinPath); err != nil || fi.IsDir() || fi.Mode()&0o111 == 0 {\n    return fmt.Errorf(\"session binary %s missing or not executable\", sessionBinPath)\n}","typeGuard":null,"tryCatchPattern":"if err := startSessionSubprocess(...); err != nil {\n    var execErr *exec.Error\n    if errors.As(err, &execErr) {\n        log.Printf(\"session binary %q unusable: %v\", execErr.Name, execErr.Err)\n    } else if errors.Is(err, os.ErrPermission) {\n        log.Printf(\"permission denied spawning session subprocess\")\n    }\n    return err\n}","preventionTips":["Ship the session subprocess binary in the image and chmod +x it","Keep container seccomp/AppArmor profiles permissive enough for fork/exec","Raise nproc ulimits for workloads spawning many processes","Monitor memory to avoid fork failures under pressure (EAGAIN/OOM)"],"tags":["process","fork","init"],"backgroundTag":"process-spawn-failed","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}