pulumi/pulumi · error

language host could not make connection to engine: %w

Error message

language host could not make connection to engine: %w

What it means

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'.

Source

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

		typechecker:   typechecker,
		toolchain:     toolchain,
		cancelCtx:     ctx,
		cancelFunc:    cancel,
	}
}

func (host *pythonLanguageHost) connectToEngine() (pulumirpc.EngineClient, io.Closer, error) {
	if host.engineAddress == "" {
		return nil, nil, errors.New("when debugging or running explicitly, must call Handshake before Run")
	}

	conn, err := grpc.NewClient(
		host.engineAddress,
		grpc.WithTransportCredentials(insecure.NewCredentials()),
		rpcutil.GrpcChannelOptions(),
	)
	if err != nil {
		return nil, nil, fmt.Errorf("language host could not make connection to engine: %w", err)
	}

	engineClient := pulumirpc.NewEngineClient(conn)
	return engineClient, conn, nil
}

func (host *pythonLanguageHost) GetRequiredPackages(ctx context.Context,
	req *pulumirpc.GetRequiredPackagesRequest,
) (*pulumirpc.GetRequiredPackagesResponse, error) {
	opts, err := parseOptions(req.Info.RootDirectory, req.Info.ProgramDirectory, req.Info.Options.AsMap(), false)
	if err != nil {
		return nil, err
	}

	tc, err := toolchain.ResolveToolchain(opts)
	if err != nil {
		return nil, err
	}

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Verify PULUMI_ENGINE_ADDR is a valid gRPC target (host:port or passthrough scheme) and unchanged from what the engine passed
  2. Unset or fix HTTPS_PROXY/NO_PROXY so localhost gRPC traffic is not intercepted
  3. Re-run via the Pulumi CLI so a fresh engine address is supplied
  4. Update the Pulumi CLI/SDK together so grpc versions match

Example fix

// before
export PULUMI_ENGINE_ADDR="localhost:invalid port"
// after
unset PULUMI_ENGINE_ADDR  # let the engine pass a fresh address on launch
Defensive patterns

Strategy: retry

Validate before calling

// Go: sanity-check the target before dialing
if _, _, err := net.SplitHostPort(strings.TrimPrefix(addr, "passthrough:///")); err != nil {
    return fmt.Errorf("invalid engine address %q: %w", addr, err)
}

Try / catch

conn, err := grpc.NewClient(addr, opts...)
if err != nil {
    // validate address, clear proxies, then retry with backoff
    return fmt.Errorf("language host could not make connection to engine: %w", err)
}

Prevention

When it happens

Trigger: grpc.NewClient fails for the engineAddress target — malformed address scheme, invalid dial target, or option-construction errors — during Run or other engine-dependent RPCs.

Common situations: Corrupted PULUMI_ENGINE_ADDR environment value, proxy/HTTPS_PROXY interception of the local address, or a mismatched/incompatible grpc library version.

Related errors


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