{"record":{"id":"cf9912eb5e4deee1","repo":"kubernetes/kops","slug":"error-creating-endpoint-v","errorCode":null,"errorMessage":"Error creating endpoint: %v","messagePattern":"Error creating endpoint: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"discovery/pkg/discovery/server.go","lineNumber":173,"sourceCode":"\tif err := json.NewDecoder(r.Body).Decode(&input); err != nil {\n\t\thttp.Error(w, \"Invalid request body\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Validation: ensure the name matches the clientID from the cert\n\tif input.ObjectMeta.Name != \"\" && input.ObjectMeta.Name != userInfo.ClientID {\n\t\thttp.Error(w, fmt.Sprintf(\"Forbidden: cannot register node name '%s' with client cert '%s'\", input.ObjectMeta.Name, userInfo.ClientID), http.StatusForbidden)\n\t\treturn\n\t}\n\n\t// Validation: ensure the namespace in body matches the URL\n\tif input.ObjectMeta.Namespace != ns {\n\t\thttp.Error(w, \"Forbidden: namespace does not match\", http.StatusForbidden)\n\t\treturn\n\t}\n\n\tif err := s.Store.UpsertDiscoveryEndpoint(r.Context(), universeID, &input); err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Error creating 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\nfunc (s *Server) handleApplyDiscoveryEndpoint(w http.ResponseWriter, r *http.Request, userInfo *UserInfo) {\n\tctx := r.Context()\n\tlog := klog.FromContext(ctx)\n\n\tuniverseID := r.PathValue(\"universe\")\n\tns := r.PathValue(\"namespace\")\n\tname := r.PathValue(\"name\")\n\n\tvar input api.DiscoveryEndpoint\n\tif err := json.NewDecoder(r.Body).Decode(&input); err != nil {\n\t\tlog.Info(\"invalid request body\", \"error\", err)","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/discovery/pkg/discovery/server.go#L155-L191","documentation":"After passing validations, handleCreateDiscoveryEndpoint calls Store.UpsertDiscoveryEndpoint to persist the object. A failure there is returned as 500 'Error creating endpoint: <underlying store error>'. The request itself was valid; persistence failed.","triggerScenarios":"POST create where the store backend errors on write: backend unreachable, read-only storage, quota/capacity exceeded, conflict from concurrent writes, or permission denied for the server's store credentials.","commonSituations":"Database disk full or read-only replica; store outage during node registration; credential rotation breaking server's write access; serialization conflicts under heavy concurrent registration.","solutions":["Check server logs/response body for the underlying store error.","Verify the store backend is writable and healthy (connectivity, disk, credentials).","Retry the POST after backend recovery (clients should implement backoff).","Check for store-side conflicts/quotas if errors persist."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"resp, err := client.Post(url, \"application/json\", body)\nif err == nil && resp.StatusCode == http.StatusInternalServerError {\n    time.Sleep(backoff)\n    return retry()\n}","preventionTips":["Monitor store write path health (disk, connectivity, credentials)","Implement idempotent retries with backoff for registration","Alert on 500s from create endpoints"],"tags":["http","storage","write","internal-server-error"],"backgroundTag":"backend-store-unavailable","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"}