{"record":{"id":"deafd3947119b07b","repo":"pulumi/pulumi","slug":"unable-to-allocate-tmp-file-w","errorCode":null,"errorMessage":"unable to allocate tmp file: %w","messagePattern":"unable to allocate tmp file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/go/pulumi-language-go/main.go","lineNumber":915,"sourceCode":"\t\t\tc.Port = p\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (c *debugger) Cleanup() {\n\tcontract.IgnoreError(os.Remove(c.LogDest))\n}\n\nfunc debugCommand(ctx context.Context, bin string, binArgs ...string) (*exec.Cmd, *debugger, error) {\n\tgodlv, err := executable.FindExecutable(\"dlv\")\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"unable to find 'dlv' executable: %w\", err)\n\t}\n\tlogFile, err := os.CreateTemp(\"\", \"pulumi-go-dlv-\")\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"unable to allocate tmp file: %w\", err)\n\t}\n\tcontract.IgnoreClose(logFile)\n\targs := []string{\"--headless=true\", \"--api-version=2\"}\n\targs = append(args, \"--log\", \"--log-dest\", logFile.Name())\n\tport, err := netutil.FindNextAvailablePort(preferredDebugPort)\n\tif err == nil {\n\t\targs = append(args, \"--listen=127.0.0.1:\"+strconv.Itoa(port))\n\t}\n\targs = append(args, \"exec\", bin)\n\tif len(binArgs) > 0 {\n\t\targs = append(args, \"\")\n\t\targs = append(args, binArgs...)\n\t}\n\tdlvCmd := exec.CommandContext(ctx, godlv, args...)\n\treturn dlvCmd, &debugger{Host: \"127.0.0.1\", LogDest: logFile.Name()}, nil\n}\n\nfunc startDebugging(ctx context.Context, engineClient pulumirpc.EngineClient, dbg *debugger, name string) error {","sourceCodeStart":897,"sourceCodeEnd":933,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/go/pulumi-language-go/main.go#L897-L933","documentation":"When starting the Delve debugger, the language host creates a temporary log file with os.CreateTemp(\"\", \"pulumi-go-dlv-\") for debugger logs; if temp file creation fails the host aborts debugger startup with this error. It reflects a filesystem/environment problem, not a problem with your program.","triggerScenarios":"debugCommand runs during `pulumi up --debug` for a Go project and os.CreateTemp fails (typically because TMPDIR is unwritable, full, or misconfigured).","commonSituations":"TMPDIR pointing to a nonexistent or read-only directory; disk full; hardened containers/seccomp denying file creation in /tmp; extremely restrictive umask or security policies.","solutions":["Check TMPDIR: `echo $TMPDIR` and confirm the directory exists and is writable; unset or fix it if broken.","Free disk space on the volume backing /tmp.","Verify you can create files: `touch /tmp/pulumi-test && rm /tmp/pulumi-test`.","If debugging was unintended, remove the `--debug` flag so no debugger temp file is created."],"exampleFix":"// before\n$ export TMPDIR=/nonexistent\n$ pulumi up --debug\nerror: unable to allocate tmp file: open /nonexistent/pulumi-go-dlv-...: no such file or directory\n// after\n$ unset TMPDIR   # or point it at a writable dir\n$ pulumi up --debug","handlingStrategy":"validation","validationCode":"if dir := os.TempDir(); dir == \"\" {\n    return errors.New(\"TMPDIR unset\")\n} else if f, err := os.CreateTemp(dir, \"pulumi-test-\"); err != nil {\n    return fmt.Errorf(\"temp dir not writable: %w\", err)\n} else {\n    f.Close(); os.Remove(f.Name())\n}","typeGuard":null,"tryCatchPattern":"err := pulumiUp(ctx, \"--debug\")\nif err != nil && strings.Contains(err.Error(), \"unable to allocate tmp file\") {\n    // fix TMPDIR / disk space and retry\n}","preventionTips":["Keep TMPDIR pointing at an existing writable directory.","Monitor disk space on the temp volume.","Avoid hardened sandboxes that block /tmp writes for pulumi.","Skip --debug in production/CI runs."],"tags":["go","debugging","filesystem","tmpdir"],"backgroundTag":"temp-file-creation-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}