{"record":{"id":"12f3635fc82bdece","repo":"gravitational/teleport","slug":"all-fetched-nodes-already-enrolled","errorCode":null,"errorMessage":"all fetched nodes already enrolled","messagePattern":"all fetched nodes already enrolled","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"info","filePath":"lib/srv/discovery/discovery.go","lineNumber":84,"sourceCode":"\t\"github.com/gravitational/teleport/lib/cryptosuites\"\n\t\"github.com/gravitational/teleport/lib/services\"\n\t\"github.com/gravitational/teleport/lib/services/readonly\"\n\t\"github.com/gravitational/teleport/lib/srv/discovery/common\"\n\t\"github.com/gravitational/teleport/lib/srv/discovery/fetchers\"\n\taws_sync \"github.com/gravitational/teleport/lib/srv/discovery/fetchers/aws-sync\"\n\tazure_sync \"github.com/gravitational/teleport/lib/srv/discovery/fetchers/azuresync\"\n\t\"github.com/gravitational/teleport/lib/srv/discovery/fetchers/db\"\n\t\"github.com/gravitational/teleport/lib/srv/server\"\n\t\"github.com/gravitational/teleport/lib/utils\"\n\t\"github.com/gravitational/teleport/lib/utils/aws/iamutils\"\n\tliborganizations \"github.com/gravitational/teleport/lib/utils/aws/organizations\"\n\t\"github.com/gravitational/teleport/lib/utils/aws/stsutils\"\n\tlogutils \"github.com/gravitational/teleport/lib/utils/log\"\n\tlibslices \"github.com/gravitational/teleport/lib/utils/slices\"\n\t\"github.com/gravitational/teleport/lib/utils/spreadwork\"\n)\n\nvar errNoInstances = errors.New(\"all fetched nodes already enrolled\")\n\nconst noDiscoveryConfig = \"\"\n\n// Matchers contains all matchers used by discovery service\ntype Matchers struct {\n\t// AWS is a list of AWS EC2 matchers.\n\tAWS []types.AWSMatcher\n\t// Azure is a list of Azure matchers to discover resources.\n\tAzure []types.AzureMatcher\n\t// GCP is a list of GCP matchers to discover resources.\n\tGCP []types.GCPMatcher\n\t// Kubernetes is a list of Kubernetes matchers to discovery resources.\n\tKubernetes []types.KubernetesMatcher\n\t// AccessGraph is the configuration for the Access Graph Cloud sync.\n\tAccessGraph *types.AccessGraphSync\n}\n\nfunc (m Matchers) IsEmpty() bool {","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/lib/srv/discovery/discovery.go#L66-L102","documentation":"errNoInstances is a sentinel error returned by the discovery service's GCP instance handler when the watcher delivers an Instances batch whose Instances list is empty. It is not a failure: it signals that all discovered GCP VMs were filtered out (already enrolled or not matching matchers). Callers check errors.Is(err, errNoInstances) and log at debug level instead of treating it as an error.","triggerScenarios":"handleGCPInstances receives a GCP instances fetch result where len(instances.Instances) == 0 — the GCP watcher poll returned no new VMs after filtering against cluster membership.","commonSituations":"Periodic GCP VM discovery poll where all VMs are already enrolled; over-restrictive discovery matchers filtering out every VM; GCP project/zone with no instances.","solutions":["No action needed if expected — this is informational; discovery will retry on the next poll","Check discovery matchers (labels, zones, project IDs) if you expected VMs to be discovered","Verify the VMs are not already enrolled in the cluster under different names"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if instances == nil || len(instances.Instances) == 0 {\n    log.DebugContext(ctx, \"no new GCP instances to enroll\")\n    return nil\n}","typeGuard":"func hasInstances(in *inventory.Instances) bool { return in != nil && len(in.Instances) > 0 }","tryCatchPattern":"if err := s.handleGCPInstances(instances); err != nil {\n    if errors.Is(err, errNoInstances) {\n        s.Log.DebugContext(s.ctx, \"All discovered GCP VMs are already part of the cluster\")\n        return nil\n    }\n    return trace.Wrap(err)\n}","preventionTips":["Treat empty discovery batches as normal periodic-poll outcomes","Log empty results at debug level, not error","Review matchers if empty results are unexpected"],"tags":["discovery","gcp","empty-result"],"backgroundTag":"no-resources-discovered","analyzedSha":"1283425b60ec5f60d509ba4c791183d452923ff7","analyzedAt":"2026-09-02T04:06:41.601Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}