pulumi/pulumi · error

Program exited with non-zero exit code: %d

Error message

Program exited with non-zero exit code: %d

What it means

The user's NodeJS program exited with a non-zero exit code and the stderr sniffer did not detect a known pattern (like an OOM), so the language host reports a plain 'Program exited with non-zero exit code: <code>'. The actual user-facing error was usually already printed by the program itself to stderr/stdout above this message.

Source

Thrown at sdk/nodejs/cmd/pulumi-language-nodejs/main.go:1062

		contract.IgnoreError(os.Stdout.Sync())
		contract.IgnoreError(os.Stderr.Sync())
		// Close the write end of the pipe to signal to the sniffer that it should stop scanning.
		contract.IgnoreClose(w)
		if exiterr, ok := err.(*exec.ExitError); ok {
			// If the program ran, but exited with a non-zero error code.  This will happen often,
			// since user errors will trigger this.  So, the error message should look as nice as
			// possible.
			switch code := exiterr.ExitCode(); code {
			case 0:
				// This really shouldn't happen, but if it does, we don't want to render "non-zero exit code"
				err = fmt.Errorf("Program exited unexpectedly: %w", exiterr)
			case nodeJSProcessExitedAfterShowingUserActionableMessage:
				// Check if we got special exit code that means "we already gave the user an
				// actionable message". In that case, we can simply bail out and terminate `pulumi`
				// without showing any more messages.
				return &pulumirpc.RunResponse{Error: "", Bail: true}
			default:
				err = fmt.Errorf("Program exited with non-zero exit code: %d", code)
				sniffer.Wait()
				if sniffer.Detected() {
					err = fmt.Errorf("Program exited with non-zero exit code: %d. %s", code, sniffer.Message())
				}
			}
		} else {
			// Otherwise, we didn't even get to run the program.  This ought to never happen unless there's
			// a bug or system condition that prevented us from running the language exec.  Issue a scarier error.
			err = fmt.Errorf("Problem executing program (could not run language executor): %w", err)
		}

		errResult = err.Error()
	}

	// notify our caller of the response we got from the nodejs process.  Note: this is done
	// unilaterally. this is how we signal to nodeLanguageHost.Run that we are done and it can
	// return to its caller.
	return &pulumirpc.RunResponse{Error: errResult}

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Read the stack trace/output printed by the program above this message and fix the root cause there.
  2. Run the program's entry point directly with node/ts-node to reproduce and debug the exception.
  3. Check that entryPoint in Pulumi.yaml points at a file that exists and compiles.
  4. Install missing dependencies (`npm install` / `yarn install`) in the program directory.
Defensive patterns

Strategy: validation

Validate before calling

// Smoke-test the program before pulumi up
cd $(pwd) && npx tsc --noEmit && node -e "require('./bin')" # or your entrypoint

Prevention

When it happens

Trigger: cmd.Wait() returns *exec.ExitError with exit code not equal to 0 and not equal to nodeJSProcessExitedAfterShowingUserActionableMessage, and sniffer.Detected() is false (sdk/nodejs/cmd/pulumi-language-nodejs/main.go:1061-1062).

Common situations: TypeScript compile errors, unhandled exceptions in the Pulumi program, module-not-found, syntax errors — any crash of user code that prints its own message and exits nonzero.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/12d6960263d20cec. Report an issue: GitHub.