pulumi/pulumi · error
resolving command: %w
Error message
resolving command: %w
What it means
This error wraps the failure from exec.LookPath when the Pulumi ESC CLI tries to resolve the executable named in the environment's defined command. openEnvironments runs a command from the opened environment; if the binary cannot be found on PATH or is not executable, LookPath fails and this wrapper adds context that the failure occurred while resolving the command.
Source
Thrown at pkg/cmd/esc/cli/env_run.go:156
if err := envcmd.esc.getCachedClient(ctx); err != nil {
return err
}
// If -- was used but there's no arguments, it means no environment was specified before the command
if cmd.ArgsLenAtDash() == 0 {
return errors.New("no environment specified")
}
ref, args, err := envcmd.getExistingEnvRef(ctx, args)
if err != nil {
return err
}
if len(args) == 0 {
return errors.New("no command specified")
}
command, err := envcmd.esc.exec.LookPath(args[0])
if err != nil {
return fmt.Errorf("resolving command: %w", err)
}
args = args[1:]
env, diags, err := envcmd.openEnvironment(ctx, ref, duration, draft)
if err != nil {
return err
}
if len(diags) != 0 {
return envcmd.writePropertyEnvironmentDiagnostics(envcmd.esc.stderr, diags)
}
files, environ, secrets, _, err := envcmd.prepareEnvironment(env, PrepareOptions{})
if err != nil {
return err
}
defer envcmd.removeTemporaryFiles(files)
envV := esc.NewValue(env.Properties)View on GitHub (pinned to 793f7b2e16)
Solutions
- Verify the command exists and is executable: `command -v <cmd>` or `which <cmd>` in the same shell
- Install the missing binary or add its directory to PATH before invoking `esc run`
- Run with the full absolute path to the executable, e.g. `esc run myenv -- /usr/local/bin/tool`
- Check whether the ESC environment definition overrides PATH and correct it
Example fix
// before pulumi esc run my-env -- npn run build // after pulumi esc run my-env -- npm run build
Defensive patterns
Strategy: validation
Validate before calling
if ! command -v "$1" >/dev/null 2>&1; then echo "command not found: $1" >&2; exit 1; fi
Try / catch
err := cmd.Run(); if err != nil && strings.Contains(err.Error(), "resolving command:") { /* check PATH / install binary */ } Prevention
- Check `command -v <cmd>` before esc run
- Use absolute paths for binaries in scripts
- Keep PATH consistent between your shell and the esc run invocation
- Install required tools in CI images
When it happens
Trigger: Running `pulumi esc run <env> -- <cmd>` where <cmd> does not exist in PATH, is not executable, or the opened environment modifies PATH to exclude the binary's directory.
Common situations: Typo in the command name; command installed in a directory not on PATH; running inside a container/CI image missing the tool; environment definition sets a working directory or PATH that hides the binary.
Related errors
- finding %q on path: %w
- could not set config: %w
- failed to get version: %w
- stack name must not be empty
- organization name must be 'organization'
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/db8d39704ba9178a.
Report an issue: GitHub.