pulumi/pulumi · critical

could not determine current executable: %w

Error message

could not determine current executable: %w

What it means

When no explicit executor is given, the Python language host locates its default executor script (pulumi-language-python-exec) next to its own binary. If os.Executable() fails to resolve the current executable's path, the error is wrapped as 'could not determine current executable' and passed to cmdutil.Exit, terminating the language host.

Source

Thrown at sdk/python/cmd/pulumi-language-python/main.go:153

	// Use OTel when the CLI provides an OTLP endpoint; fall back to
	// OpenTracing otherwise.  Only one system should be active to avoid
	// duplicate spans.
	otelEndpoint := os.Getenv("PULUMI_OTEL_EXPORTER_OTLP_ENDPOINT")
	if otelEndpoint == "" {
		cmdutil.InitTracing("pulumi-language-python", "pulumi-language-python", tracing)
	} else {
		if err := cmdutil.InitOtelTracing("pulumi-language-python", otelEndpoint); err != nil {
			logging.V(3).Infof("failed to initialize OTel tracing: %v", err)
		}
		defer cmdutil.CloseOtelTracing()
	}

	var pythonExec string
	if givenExecutor == "" {
		// By default, the -exec script is installed next to the language host.
		thisPath, err := os.Executable()
		if err != nil {
			err = fmt.Errorf("could not determine current executable: %w", err)
			cmdutil.Exit(err)
		}

		pathExec := filepath.Join(filepath.Dir(thisPath), pythonDefaultExec)
		if _, err = os.Stat(pathExec); os.IsNotExist(err) {
			err = fmt.Errorf("missing executor %s: %w", pathExec, err)
			cmdutil.Exit(err)
		}

		logging.V(3).Infof("language host identified executor from path: `%s`", pathExec)
		pythonExec = pathExec
	} else {
		logging.V(3).Infof("language host asked to use specific executor: `%s`", givenExecutor)
		pythonExec = givenExecutor
	}

	// Optionally pluck out the engine so we can do logging, etc.
	var engineAddress string

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Re-install or rebuild the Pulumi CLI/plugins so the running binary exists on disk (pulumi plugins install / re-download)
  2. Avoid upgrading or deleting Pulumi binaries while a deployment is running
  3. Run the language host directly from its real installed path rather than through wrappers that exec from tmpfs
  4. Check the wrapped OS error after the colon for the precise reason (e.g. 'no such file or directory') and fix that path

Example fix

// before: binary deleted mid-run (e.g. by an upgrade script)
rm -f $(which pulumi-language-python) && pulumi up
// after: upgrade when no deployments are running
pulumi up  # then upgrade
pulumi plugin install language python
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
const hostBin = process.argv[1]; // path of the language host about to run
if (!fs.existsSync(hostBin)) {
  throw new Error(`language host binary missing on disk: ${hostBin}; reinstall pulumi`);
}

Type guard

const isExecutableResolutionError = (err) => err instanceof Error && /could not determine current executable/.test(err.message);

Try / catch

try {
  spawnLanguageHost();
} catch (err) {
  if (isExecutableResolutionError(err)) {
    console.error('Reinstall the Pulumi CLI/plugin; the host binary path could not be resolved:', err.cause ?? err);
  }
  throw err;
}

Prevention

When it happens

Trigger: os.Executable() returns an error at language-host startup — e.g. the binary was deleted after launch, /proc is unavailable, or the process was started in an environment where the executable path cannot be resolved.

Common situations: Running the language host from a container/image where the binary was replaced after start; PATH/executable oddities in minimal containers; running via symlinks or wrappers on unusual filesystems; running a binary deleted mid-run (common after plugin upgrades while a stack operation is in flight).

Related errors


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