{"record":{"id":"c18286bb378c0649","repo":"pulumi/pulumi","slug":"language-host-could-not-make-connection-to-engine-c18286","errorCode":null,"errorMessage":"language host could not make connection to engine: %w","messagePattern":"language host could not make connection to engine: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/python/cmd/pulumi-language-python/main.go","lineNumber":319,"sourceCode":"\t\ttypechecker:   typechecker,\n\t\ttoolchain:     toolchain,\n\t\tcancelCtx:     ctx,\n\t\tcancelFunc:    cancel,\n\t}\n}\n\nfunc (host *pythonLanguageHost) connectToEngine() (pulumirpc.EngineClient, io.Closer, error) {\n\tif host.engineAddress == \"\" {\n\t\treturn nil, nil, errors.New(\"when debugging or running explicitly, must call Handshake before Run\")\n\t}\n\n\tconn, err := grpc.NewClient(\n\t\thost.engineAddress,\n\t\tgrpc.WithTransportCredentials(insecure.NewCredentials()),\n\t\trpcutil.GrpcChannelOptions(),\n\t)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"language host could not make connection to engine: %w\", err)\n\t}\n\n\tengineClient := pulumirpc.NewEngineClient(conn)\n\treturn engineClient, conn, nil\n}\n\nfunc (host *pythonLanguageHost) GetRequiredPackages(ctx context.Context,\n\treq *pulumirpc.GetRequiredPackagesRequest,\n) (*pulumirpc.GetRequiredPackagesResponse, error) {\n\topts, err := parseOptions(req.Info.RootDirectory, req.Info.ProgramDirectory, req.Info.Options.AsMap(), false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttc, err := toolchain.ResolveToolchain(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/python/cmd/pulumi-language-python/main.go#L301-L337","documentation":"connectToEngine dials the Pulumi engine's gRPC endpoint with grpc.NewClient. If the client cannot even be constructed (invalid target address, bad options), the error is wrapped as 'language host could not make connection to engine: %w'.","triggerScenarios":"grpc.NewClient fails for the engineAddress target — malformed address scheme, invalid dial target, or option-construction errors — during Run or other engine-dependent RPCs.","commonSituations":"Corrupted PULUMI_ENGINE_ADDR environment value, proxy/HTTPS_PROXY interception of the local address, or a mismatched/incompatible grpc library version.","solutions":["Verify PULUMI_ENGINE_ADDR is a valid gRPC target (host:port or passthrough scheme) and unchanged from what the engine passed","Unset or fix HTTPS_PROXY/NO_PROXY so localhost gRPC traffic is not intercepted","Re-run via the Pulumi CLI so a fresh engine address is supplied","Update the Pulumi CLI/SDK together so grpc versions match"],"exampleFix":"// before\nexport PULUMI_ENGINE_ADDR=\"localhost:invalid port\"\n// after\nunset PULUMI_ENGINE_ADDR  # let the engine pass a fresh address on launch","handlingStrategy":"retry","validationCode":"// Go: sanity-check the target before dialing\nif _, _, err := net.SplitHostPort(strings.TrimPrefix(addr, \"passthrough:///\")); err != nil {\n    return fmt.Errorf(\"invalid engine address %q: %w\", addr, err)\n}","typeGuard":null,"tryCatchPattern":"conn, err := grpc.NewClient(addr, opts...)\nif err != nil {\n    // validate address, clear proxies, then retry with backoff\n    return fmt.Errorf(\"language host could not make connection to engine: %w\", err)\n}","preventionTips":["Set NO_PROXY to include localhost/127.0.0.1 so local gRPC is not proxied","Never hand-edit PULUMI_ENGINE_ADDR; let the engine supply it","Upgrade CLI and language host together to keep grpc versions aligned"],"tags":["grpc","network","python","connection"],"backgroundTag":"grpc-connection-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}