{"record":{"id":"d7e9fa1dd5d59602","repo":"temporalio/temporal","slug":"unable-to-list-nexus-endpoints-for-namespace-s","errorCode":null,"errorMessage":"unable to list Nexus endpoints for namespace %s: %w","messagePattern":"unable to list Nexus endpoints for namespace (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/worker/deletenamespace/activities.go","lineNumber":127,"sourceCode":"\t}\n\treturn nil\n}\n\nfunc (a *localActivities) ValidateNexusEndpointsActivity(ctx context.Context, nsID namespace.ID, nsName namespace.Name) error {\n\tif a.allowDeleteNamespaceIfNexusEndpointTarget() {\n\t\treturn nil\n\t}\n\t// Prevent deletion of a namespace that is targeted by a Nexus endpoint.\n\tvar nextPageToken []byte\n\tfor {\n\t\tresp, err := a.nexusEndpointManager.ListNexusEndpoints(ctx, &persistence.ListNexusEndpointsRequest{\n\t\t\tLastKnownTableVersion: 0,\n\t\t\tNextPageToken:         nextPageToken,\n\t\t\tPageSize:              a.nexusEndpointListDefaultPageSize(),\n\t\t})\n\t\tif err != nil {\n\t\t\ta.logger.Error(\"Unable to list Nexus endpoints from persistence.\", tag.WorkflowNamespace(nsName.String()), tag.WorkflowNamespaceID(nsID.String()), tag.Error(err))\n\t\t\treturn fmt.Errorf(\"unable to list Nexus endpoints for namespace %s: %w\", nsName, err)\n\t\t}\n\n\t\tfor _, entry := range resp.Entries {\n\t\t\tif endpointNsID := entry.GetEndpoint().GetSpec().GetTarget().GetWorker().GetNamespaceId(); endpointNsID == nsID.String() {\n\t\t\t\treturn errors.NewFailedPrecondition(fmt.Sprintf(\"cannot delete a namespace that is a target of a Nexus endpoint %s\", entry.GetEndpoint().GetSpec().GetName()), nil)\n\t\t\t}\n\t\t}\n\t\tnextPageToken = resp.NextPageToken\n\t\tif len(nextPageToken) == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (a *localActivities) MarkNamespaceDeletedActivity(ctx context.Context, nsName namespace.Name) error {\n\tctx = headers.SetCallerName(ctx, nsName.String())\n","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/worker/deletenamespace/activities.go#L109-L145","documentation":"ValidateNexusEndpointsActivity lists Nexus endpoints page by page from persistence to verify the namespace being deleted is not a target of any endpoint. If the persistence ListNexusEndpoints call fails, the activity logs the failure and wraps it in this error, aborting namespace deletion validation.","triggerScenarios":"Deleting a namespace when the persistence-backed ListNexusEndpoints call errors — DB unavailable, timeout, shard/row issues, or persistence connectivity problems during the paginated loop.","commonSituations":"Database outage or high latency during namespace deletion; persistence retries exhausted; cluster under load causing list timeouts; running the delete-Nexus-validation activity against a misconfigured persistence store.","solutions":["Retry the namespace deletion activity once persistence is healthy — the error is typically transient.","Check the wrapped persistence error (and logged tag.Error) to diagnose DB connectivity, timeouts, or schema issues.","Verify persistence configuration and endpoint table health (LastKnownTableVersion handling, migrations applied).","Increase activity retry policy attempts/interval for this activity so transient DB blips don't fail the workflow."],"exampleFix":"// before\nactivityOpts := workflow.ActivityOptions{StartToCloseTimeout: 10 * time.Second} // too tight, times out listing endpoints\n// after\nactivityOpts := workflow.ActivityOptions{\n  StartToCloseTimeout: 30 * time.Second,\n  RetryPolicy: &temporal.RetryPolicy{InitialInterval: time.Second, MaximumAttempts: 5},\n}","handlingStrategy":"retry","validationCode":"// pre-check persistence health before running the deletion workflow\nif err := persistenceHealthCheck(ctx); err != nil {\n  return fmt.Errorf(\"postpone namespace deletion; persistence unhealthy: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"err := workflow.ExecuteActivity(ctx, a.ValidateNexusEndpointsActivity, nsName, nsID).Get(ctx, nil)\nif err != nil {\n  if strings.Contains(err.Error(), \"unable to list Nexus endpoints\") {\n    logger.Warn(\"transient persistence failure validating nexus endpoints; will retry\", tag.Error(err))\n    return err // let workflow retry policy handle it\n  }\n  return err\n}","preventionTips":["Attach a retry policy (5 attempts, exponential backoff) to the validation activity.","Monitor persistence error rates to anticipate deletion-workflow failures.","Ensure Nexus endpoint table migrations are applied before deletion operations.","Run namespace deletions during low DB load windows."],"tags":["go","nexus","persistence","namespace-deletion"],"backgroundTag":"persistence-list-failed","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}