pulumi/pulumi · error
unable to allocate tmp file: %w
Error message
unable to allocate tmp file: %w
What it means
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.
Source
Thrown at sdk/go/pulumi-language-go/main.go:915
c.Port = p
break
}
}
return nil
}
func (c *debugger) Cleanup() {
contract.IgnoreError(os.Remove(c.LogDest))
}
func debugCommand(ctx context.Context, bin string, binArgs ...string) (*exec.Cmd, *debugger, error) {
godlv, err := executable.FindExecutable("dlv")
if err != nil {
return nil, nil, fmt.Errorf("unable to find 'dlv' executable: %w", err)
}
logFile, err := os.CreateTemp("", "pulumi-go-dlv-")
if err != nil {
return nil, nil, fmt.Errorf("unable to allocate tmp file: %w", err)
}
contract.IgnoreClose(logFile)
args := []string{"--headless=true", "--api-version=2"}
args = append(args, "--log", "--log-dest", logFile.Name())
port, err := netutil.FindNextAvailablePort(preferredDebugPort)
if err == nil {
args = append(args, "--listen=127.0.0.1:"+strconv.Itoa(port))
}
args = append(args, "exec", bin)
if len(binArgs) > 0 {
args = append(args, "")
args = append(args, binArgs...)
}
dlvCmd := exec.CommandContext(ctx, godlv, args...)
return dlvCmd, &debugger{Host: "127.0.0.1", LogDest: logFile.Name()}, nil
}
func startDebugging(ctx context.Context, engineClient pulumirpc.EngineClient, dbg *debugger, name string) error {View on GitHub (pinned to 793f7b2e16)
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.
Example fix
// before $ export TMPDIR=/nonexistent $ pulumi up --debug error: unable to allocate tmp file: open /nonexistent/pulumi-go-dlv-...: no such file or directory // after $ unset TMPDIR # or point it at a writable dir $ pulumi up --debug
Defensive patterns
Strategy: validation
Validate before calling
if dir := os.TempDir(); dir == "" {
return errors.New("TMPDIR unset")
} else if f, err := os.CreateTemp(dir, "pulumi-test-"); err != nil {
return fmt.Errorf("temp dir not writable: %w", err)
} else {
f.Close(); os.Remove(f.Name())
} Try / catch
err := pulumiUp(ctx, "--debug")
if err != nil && strings.Contains(err.Error(), "unable to allocate tmp file") {
// fix TMPDIR / disk space and retry
} Prevention
- 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.
When it happens
Trigger: debugCommand runs during `pulumi up --debug` for a Go project and os.CreateTemp fails (typically because TMPDIR is unwritable, full, or misconfigured).
Common situations: 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.
Related errors
- create global project dir: %w
- filesystem extra root %q is not a directory
- resolving shell cwd: %w
- resolving shell extra root %q: %w
- shell extra root %q: %w
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/deafd3947119b07b.
Report an issue: GitHub.