{"record":{"id":"d02d130f10dc0ade","repo":"dagger/dagger","slug":"open-stdout-file-w","errorCode":null,"errorMessage":"open stdout file: %w","messagePattern":"open stdout file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/engineutil/executor_spec.go","lineNumber":703,"sourceCode":"\tif state.metaMountDirPath == \"\" {\n\t\treturn nil\n\t}\n\n\tcombinedOutputPath := filepath.Join(state.metaMountDirPath, MetaMountCombinedOutputPath)\n\tcombinedOutputFile, err := os.OpenFile(combinedOutputPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o600)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"open combined output file: %w\", err)\n\t}\n\tstate.cleanups.Add(\"close container combined output file\", combinedOutputFile.Close)\n\n\tvar stdoutWriters []io.Writer\n\tif state.procInfo.Stdout != nil {\n\t\tstdoutWriters = append(stdoutWriters, state.procInfo.Stdout)\n\t}\n\tstdoutPath := filepath.Join(state.metaMountDirPath, MetaMountStdoutPath)\n\tstdoutFile, err := os.OpenFile(stdoutPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o600)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"open stdout file: %w\", err)\n\t}\n\tstate.cleanups.Add(\"close container stdout file\", stdoutFile.Close)\n\tstdoutWriters = append(stdoutWriters, stdoutFile)\n\tstdoutWriters = append(stdoutWriters, combinedOutputFile)\n\n\tvar stderrWriters []io.Writer\n\tif state.procInfo.Stderr != nil {\n\t\tstderrWriters = append(stderrWriters, state.procInfo.Stderr)\n\t}\n\tstderrPath := filepath.Join(state.metaMountDirPath, MetaMountStderrPath)\n\tstderrFile, err := os.OpenFile(stderrPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o600)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"open stderr file: %w\", err)\n\t}\n\tstate.cleanups.Add(\"close container stderr file\", stderrFile.Close)\n\tstderrWriters = append(stderrWriters, stderrFile)\n\tstderrWriters = append(stderrWriters, combinedOutputFile)\n","sourceCodeStart":685,"sourceCodeEnd":721,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/engine/engineutil/executor_spec.go#L685-L721","documentation":"setupStdio opens a dedicated stdout capture file (MetaMountStdoutPath) in the meta mount dir so the container's stdout is both streamed and persisted. If os.OpenFile fails, the whole stdio wiring fails and the exec is rejected with this wrapped OS error. It is distinct from the combined-output file: only the stdout path failed.","triggerScenarios":"os.OpenFile(metaMountDirPath + MetaMountStdoutPath, O_CREATE|O_WRONLY|O_APPEND, 0600) errors during setupStdio — same class of causes as 4120 but on the stdout-specific path.","commonSituations":"ENOSPC on the engine host; meta mount directory permissions changed externally; SELinux/AppArmor denying writes to the engine data dir; partially deleted engine state after a crash.","solutions":["Free disk space on the engine data volume (df -h, prune with dagger query or docker system prune)","Check and fix permissions/ownership of the engine meta mount directory","Restart the engine so meta mount state is recreated cleanly","Read the wrapped OS errno to target the exact cause (ENOSPC vs EACCES vs ENOENT)"],"exampleFix":"// before: 'open stdout file: no space left on device'\n// after: prune and retry\n$ df -h /var/lib/dagger\n$ docker system prune -af && dagger engine restart","handlingStrategy":"validation","validationCode":"// pre-flight on engine host\n// df -h /var/lib/dagger && test -w /var/lib/dagger && echo ok","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"open stdout file\") {\n    // inspect wrapped errno: ENOSPC -> free disk, EACCES -> fix perms, then retry\n}","preventionTips":["Alert on low disk space for the engine data dir","Avoid external edits to engine meta mount directories","Keep SELinux/AppArmor policies permissive for the engine data path"],"tags":["filesystem","stdout","stdio","dagger-engine"],"backgroundTag":"file-open-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"}