{"record":{"id":"8c3bf184ef9e4fb8","repo":"pulumi/pulumi","slug":"could-not-determine-current-executable-w","errorCode":null,"errorMessage":"could not determine current executable: %w","messagePattern":"could not determine current executable: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"sdk/python/cmd/pulumi-language-python/main.go","lineNumber":153,"sourceCode":"\t// Use OTel when the CLI provides an OTLP endpoint; fall back to\n\t// OpenTracing otherwise.  Only one system should be active to avoid\n\t// duplicate spans.\n\totelEndpoint := os.Getenv(\"PULUMI_OTEL_EXPORTER_OTLP_ENDPOINT\")\n\tif otelEndpoint == \"\" {\n\t\tcmdutil.InitTracing(\"pulumi-language-python\", \"pulumi-language-python\", tracing)\n\t} else {\n\t\tif err := cmdutil.InitOtelTracing(\"pulumi-language-python\", otelEndpoint); err != nil {\n\t\t\tlogging.V(3).Infof(\"failed to initialize OTel tracing: %v\", err)\n\t\t}\n\t\tdefer cmdutil.CloseOtelTracing()\n\t}\n\n\tvar pythonExec string\n\tif givenExecutor == \"\" {\n\t\t// By default, the -exec script is installed next to the language host.\n\t\tthisPath, err := os.Executable()\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"could not determine current executable: %w\", err)\n\t\t\tcmdutil.Exit(err)\n\t\t}\n\n\t\tpathExec := filepath.Join(filepath.Dir(thisPath), pythonDefaultExec)\n\t\tif _, err = os.Stat(pathExec); os.IsNotExist(err) {\n\t\t\terr = fmt.Errorf(\"missing executor %s: %w\", pathExec, err)\n\t\t\tcmdutil.Exit(err)\n\t\t}\n\n\t\tlogging.V(3).Infof(\"language host identified executor from path: `%s`\", pathExec)\n\t\tpythonExec = pathExec\n\t} else {\n\t\tlogging.V(3).Infof(\"language host asked to use specific executor: `%s`\", givenExecutor)\n\t\tpythonExec = givenExecutor\n\t}\n\n\t// Optionally pluck out the engine so we can do logging, etc.\n\tvar engineAddress string","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/python/cmd/pulumi-language-python/main.go#L135-L171","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Re-install or rebuild the Pulumi CLI/plugins so the running binary exists on disk (pulumi plugins install / re-download)","Avoid upgrading or deleting Pulumi binaries while a deployment is running","Run the language host directly from its real installed path rather than through wrappers that exec from tmpfs","Check the wrapped OS error after the colon for the precise reason (e.g. 'no such file or directory') and fix that path"],"exampleFix":"// before: binary deleted mid-run (e.g. by an upgrade script)\nrm -f $(which pulumi-language-python) && pulumi up\n// after: upgrade when no deployments are running\npulumi up  # then upgrade\npulumi plugin install language python","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst hostBin = process.argv[1]; // path of the language host about to run\nif (!fs.existsSync(hostBin)) {\n  throw new Error(`language host binary missing on disk: ${hostBin}; reinstall pulumi`);\n}","typeGuard":"const isExecutableResolutionError = (err) => err instanceof Error && /could not determine current executable/.test(err.message);","tryCatchPattern":"try {\n  spawnLanguageHost();\n} catch (err) {\n  if (isExecutableResolutionError(err)) {\n    console.error('Reinstall the Pulumi CLI/plugin; the host binary path could not be resolved:', err.cause ?? err);\n  }\n  throw err;\n}","preventionTips":["Never delete or upgrade Pulumi binaries while a deployment is in flight","Launch the host from its real installed path, not transient wrappers or tmpfs copies","Reinstall the plugin/CLI if plugin directories were modified externally"],"tags":["python","language-host","executable","startup"],"backgroundTag":"could-not-determine-executable","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}