{"record":{"id":"15ee2b77742211e6","repo":"kubernetes/kops","slug":"error-getting-endpoint-v","errorCode":null,"errorMessage":"Error getting endpoint: %v","messagePattern":"Error getting endpoint: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"discovery/pkg/discovery/server.go","lineNumber":236,"sourceCode":"\t\tlog.Error(err, \"error applying endpoint\")\n\t\thttp.Error(w, fmt.Sprintf(\"Error applying endpoint: %v\", err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Return the created object\n\ts.writeJSON(w, http.StatusCreated, input)\n\n\tlog.Info(\"Applied endpoint\", \"namespace\", input.ObjectMeta.Namespace, \"name\", input.ObjectMeta.Name, \"universe\", universeID)\n}\n\nfunc (s *Server) handleGetDiscoveryEndpoint(w http.ResponseWriter, r *http.Request, _ *UserInfo) {\n\tuniverseID := r.PathValue(\"universe\")\n\tns := r.PathValue(\"namespace\")\n\tname := r.PathValue(\"name\")\n\n\tfound, err := s.Store.GetDiscoveryEndpoint(r.Context(), universeID, ns, name)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Error getting endpoint: %v\", err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif found == nil {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\ts.writeJSON(w, http.StatusOK, found)\n}\n","sourceCodeStart":218,"sourceCodeEnd":247,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/discovery/pkg/discovery/server.go#L218-L247","documentation":"GET of a single DiscoveryEndpoint failed because Store.GetDiscoveryEndpoint returned an error while reading from the backend. The server wraps it into HTTP 500 with 'Error getting endpoint: %v'. A missing endpoint is NOT this error — that returns 404 via http.NotFound when found == nil.","triggerScenarios":"GET .../universes/{universe}/namespaces/{ns}/discoveryendpoints/{name} where the store lookup errors out: backend unreachable, query/context cancelled, store deserialization failure, or permission denial at the storage layer.","commonSituations":"Discovery server cannot reach its storage backend; corrupted stored record that fails to deserialize; read credentials revoked; timeouts under load between server and store.","solutions":["Inspect the %v detail in the response and server logs for the underlying store error","Verify the store backend is healthy and reachable from the discovery server","If deserialization of a stored record fails, delete/repair the corrupt record in the store","Retry with backoff for transient connectivity issues"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Distinguish 404 (not found) from 500 (store failure) so callers can fall back gracefully\nep, err := client.GetDiscoveryEndpoint(ctx, universe, ns, name)\nif err != nil {\n    var httpErr *HTTPError\n    if errors.As(err, &httpErr) && httpErr.StatusCode == http.StatusInternalServerError {\n        // store read failed; use cached endpoint if available\n    }\n    return err\n}","typeGuard":"func isStoreReadFailure(err error) bool {\n    var httpErr *HTTPError\n    return errors.As(err, &httpErr) &&\n        httpErr.StatusCode == http.StatusInternalServerError &&\n        strings.Contains(httpErr.Body, \"Error getting endpoint\")\n}","tryCatchPattern":"ep, err := client.GetDiscoveryEndpoint(ctx, universe, ns, name)\nif err != nil {\n    if isStoreReadFailure(err) {\n        if cached != nil {\n            return cached // fall back to last known endpoint\n        }\n        return fmt.Errorf(\"store unavailable: %w\", err)\n    }\n    return err // includes 404 NotFound, handle separately\n}","preventionTips":["Keep a local cache of last-read endpoints to survive transient store outages","Monitor store backend health/read latency from the discovery server","Verify store read credentials and record integrity after upgrades","Treat 404 (found == nil) as a normal missing-object case, distinct from this 500"],"tags":["http","internal-server-error","storage","read"],"backgroundTag":"backend-store-read-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}