{"record":{"id":"c46135d5cf7c512e","repo":"cilium/cilium","slug":"failed-to-wait-for-endpoint-restorer-promise-w","errorCode":null,"errorMessage":"failed to wait for endpoint restorer promise: %w","messagePattern":"failed to wait for endpoint restorer promise: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"daemon/infraendpoints/host_endpoint.go","lineNumber":54,"sourceCode":"\tendpointRestorePromise promise.Promise[endpointstate.Restorer]\n}\n\nfunc registerHostEndpoint(params hostEndpointParams) {\n\tcreator := &hostEndpointCreator{\n\t\tlogger:                 params.Logger,\n\t\tendpointCreator:        params.EndpointCreator,\n\t\tendpointManager:        params.EndpointManager,\n\t\tendpointRestorePromise: params.EndpointRestorePromise,\n\t}\n\n\tparams.JobGroup.Add(job.OneShot(\"init-host-endpoint\", creator.createHostEndpoint, job.WithShutdown()))\n}\n\nfunc (c *hostEndpointCreator) createHostEndpoint(ctx context.Context, health cell.Health) error {\n\thealth.OK(\"Wait for endpoint restoration\")\n\tr, err := c.endpointRestorePromise.Await(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to wait for endpoint restorer promise: %w\", err)\n\t}\n\n\tif err := r.WaitForEndpointRestoreWithoutRegeneration(ctx); err != nil {\n\t\treturn fmt.Errorf(\"failed to wait for endpoint restoration: %w\", err)\n\t}\n\n\thealth.OK(\"Start initialization\")\n\n\tif c.endpointManager.HostEndpointExists() {\n\t\tc.logger.Info(\"Initializing labels on existing host endpoint\")\n\t\tc.endpointManager.InitHostEndpointLabels(ctx)\n\t\treturn nil\n\t}\n\n\tc.logger.Info(\"Creating host endpoint\")\n\tif err := c.endpointCreator.AddHostEndpoint(ctx); err != nil {\n\t\treturn fmt.Errorf(\"unable to create host endpoint: %w\", err)\n\t}","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/daemon/infraendpoints/host_endpoint.go#L36-L72","documentation":"createHostEndpoint must wait for the endpoint restorer promise (resolved once endpoint restoration completes) before creating the host endpoint. If the promise's Await(ctx) fails — most commonly because the context is cancelled/times out before restoration resolves — this error wraps the cause. The host endpoint is then not created, breaking local connectivity setup.","triggerScenarios":"c.endpointRestorePromise.Await(ctx) returns an error when ctx is done (agent shutdown, hive lifecycle cancellation, or restore never completing) before WaitForEndpointRestoreWithoutRegeneration is even reached.","commonSituations":"Endpoint restoration hanging due to stuck regeneration or bpf map issues, causing the await to time out; agent stopping during startup; deadlock in the restore dependency chain after upgrades.","solutions":["Check why endpoint restoration did not complete (look for earlier 'endpoint restore'/'regeneration' errors in agent logs)","Increase startup/lifecycle timeouts if restore is merely slow (large endpoint count)","Restart the agent; if restore persistently hangs, inspect bpf maps/state and consider cilium-dbg endpoint list diagnostics","Verify hive/cell wiring provides the endpointRestorePromise (a version mismatch can leave it never resolved)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"select {\ncase <-time.After(restoreTimeout):\n\treturn errors.New(\"endpoint restoration did not complete within timeout\")\ncase <-ctx.Done():\n\t// proceed to Await and surface its error\n}","typeGuard":null,"tryCatchPattern":"r, err := c.endpointRestorePromise.Await(ctx)\nif err != nil {\n\tif errors.Is(err, context.Canceled) {\n\t\treturn fmt.Errorf(\"host endpoint creation cancelled during shutdown: %w\", err)\n\t}\n\treturn fmt.Errorf(\"failed to wait for endpoint restorer promise: %w\", err)\n}","preventionTips":["Monitor endpoint restore latency and alert on hangs","Grant adequate startup timeouts for large node endpoint counts","Investigate upstream restore/regeneration errors first — they usually cause this await to fail","Verify promise wiring after upgrading hive/cell versions"],"tags":["endpoint-restore","lifecycle","host-endpoint","timeout"],"backgroundTag":"endpoint-restore-timeout","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}