{"record":{"id":"db8d39704ba9178a","repo":"pulumi/pulumi","slug":"resolving-command-w","errorCode":null,"errorMessage":"resolving command: %w","messagePattern":"resolving command: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/esc/cli/env_run.go","lineNumber":156,"sourceCode":"\t\t\tif err := envcmd.esc.getCachedClient(ctx); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// If -- was used but there's no arguments, it means no environment was specified before the command\n\t\t\tif cmd.ArgsLenAtDash() == 0 {\n\t\t\t\treturn errors.New(\"no environment specified\")\n\t\t\t}\n\t\t\tref, args, err := envcmd.getExistingEnvRef(ctx, args)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif len(args) == 0 {\n\t\t\t\treturn errors.New(\"no command specified\")\n\t\t\t}\n\t\t\tcommand, err := envcmd.esc.exec.LookPath(args[0])\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"resolving command: %w\", err)\n\t\t\t}\n\t\t\targs = args[1:]\n\n\t\t\tenv, diags, err := envcmd.openEnvironment(ctx, ref, duration, draft)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif len(diags) != 0 {\n\t\t\t\treturn envcmd.writePropertyEnvironmentDiagnostics(envcmd.esc.stderr, diags)\n\t\t\t}\n\n\t\t\tfiles, environ, secrets, _, err := envcmd.prepareEnvironment(env, PrepareOptions{})\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer envcmd.removeTemporaryFiles(files)\n\n\t\t\tenvV := esc.NewValue(env.Properties)","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/esc/cli/env_run.go#L138-L174","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\npulumi esc run my-env -- npn run build\n// after\npulumi esc run my-env -- npm run build","handlingStrategy":"validation","validationCode":"if ! command -v \"$1\" >/dev/null 2>&1; then echo \"command not found: $1\" >&2; exit 1; fi","typeGuard":null,"tryCatchPattern":"err := cmd.Run(); if err != nil && strings.Contains(err.Error(), \"resolving command:\") { /* check PATH / install binary */ }","preventionTips":["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"],"tags":["cli","exec","path"],"backgroundTag":"command-not-found-on-path","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}