{"record":{"id":"ac047e1f4f8bf957","repo":"dagger/dagger","slug":"new-client-w","errorCode":null,"errorMessage":"new client: %w","messagePattern":"new client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/client/client.go","lineNumber":505,"sourceCode":"\t\tCloudAuth:        params.CloudAuth,\n\t})\n\tprovisionCancel()\n\ttelemetry.EndWithCause(provisionSpan, &err)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx, span := Tracer(ctx).Start(ctx, \"connecting to engine\", telemetry.Encapsulate())\n\tdefer telemetry.EndWithCause(span, &rerr)\n\n\tslog := slog.SpanLogger(ctx, InstrumentationLibrary)\n\tslog.Debug(\"connecting\", \"runner\", c.RunnerHost)\n\n\tbkCtx, span := Tracer(ctx).Start(ctx, \"creating client\")\n\tbkClient, bkInfo, err := newBuildkitClient(bkCtx, remote, c.connector)\n\ttelemetry.EndWithCause(span, &err)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"new client: %w\", err)\n\t}\n\tc.bkClient = bkClient\n\tc.bkVersion = bkInfo.BuildkitVersion.Version\n\tc.bkName = bkInfo.BuildkitVersion.Revision\n\tc.numCPU = bkInfo.SystemInfo.NumCPU\n\n\tslog.Info(\"connected\", \"name\", c.bkName, \"client-version\", engine.Version, \"server-version\", c.bkVersion)\n\n\timageBackend := c.ImageLoaderBackend\n\tif imageBackend == nil {\n\t\timageBackend = driver.ImageLoader(ctx)\n\t}\n\tif imageBackend != nil {\n\t\timgloadCtx, span := Tracer(ctx).Start(ctx, \"configuring image store\")\n\t\tc.imageLoader, err = imageBackend.Loader(imgloadCtx)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"failed to get image loader: %w\", err)\n\t\t}","sourceCodeStart":487,"sourceCodeEnd":523,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/engine/client/client.go#L487-L523","documentation":"Wraps a failure of newBuildkitClient() at the end of startEngine — after the engine is provisioned, the client dials the engine's buildkit gRPC endpoint. Dial failures, TLS handshake errors, timeouts, or buildkit Info() RPC failures are wrapped here and abort the connect.","triggerScenarios":"Calling Connect/ConnectEngineToEngine when the buildkit gRPC dial to the started engine fails: engine not yet listening, wrong address, TLS misconfiguration, or the Info RPC times out.","commonSituations":"Slow engine startup exceeding dial timeout; engine container networking broken (host networking changes, port not exposed); proxy intercepting gRPC; clock skew breaking TLS.","solutions":["Check the wrapped cause (errors.As for *url.Error or gRPC status) for dial vs. RPC failure","Retry — races between engine readiness and dial usually resolve","Verify the engine container is running and its port/socket is reachable","Confirm TLS/proxy configuration matches the engine's expectations"],"exampleFix":"// before\nclient, err := dagger.Connect(ctx) // engine still booting, dial fails\n// after\nvar client *dagger.Client\nfor i := 0; i < 5; i++ {\n    client, err = dagger.Connect(ctx)\n    if err == nil || !strings.Contains(fmt.Sprint(err), \"new client\") {\n        break\n    }\n    time.Sleep(2 * time.Second)\n}","handlingStrategy":"retry","validationCode":"// confirm the engine endpoint is listening before dialing\nconn, err := net.DialTimeout(\"tcp\", engineAddr, 5*time.Second)\nif err != nil {\n    return fmt.Errorf(\"engine not reachable at %s: %w\", engineAddr, err)\n}\nconn.Close()","typeGuard":"func isNewClientErr(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"new client\")\n}","tryCatchPattern":"var client *dagger.Client\nerr := retry.Do(5, retry.Backoff(2*time.Second), func() error {\n    var e error\n    client, e = dagger.Connect(ctx)\n    if e != nil && isNewClientErr(e) { return e } // retry dial\n    return retry.Stop(e)\n})","preventionTips":["Pre-pull/start the engine and wait for readiness before connecting","Check that the engine port/socket is exposed and reachable","Keep TLS certs and clocks in sync to avoid handshake failures","Bypass or configure proxies for gRPC traffic"],"tags":["grpc","buildkit","network","engine"],"backgroundTag":"grpc-dial-failed","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}