diff --git a/libcalico-go/lib/backend/watchersyncer/watchercache.go b/libcalico-go/lib/backend/watchersyncer/watchercache.go index 4c92045fcd8..41975d230d3 100644 --- a/libcalico-go/lib/backend/watchersyncer/watchercache.go +++ b/libcalico-go/lib/backend/watchersyncer/watchercache.go @@ -220,7 +220,17 @@ func (wc *watcherCache) resyncAndCreateWatcher(ctx context.Context) { // Store the current watch revision. This gets updated on any new add/modified event. wc.logger.Logger.WithField("revision", l.Revision).Debug("List completed.") if l.Revision == "" || l.Revision == "0" { - wc.logger.Panic("BUG: List returned empty/zero revision. Watch would be inconsistent.") + if len(l.KVPairs) == 0 { + // Got a bad revision but there are no items. This may mean that the datastore + // returns an unhelpful "not found" error instead of an empty list. Revert to a + // poll until some items show up. + wc.logger.Info("List returned no items and an empty/zero revision, reverting to poll.") + wc.currentWatchRevision = "0" + performFullResync = true + wc.resyncBlockedUntil = time.Now().Add(WatchPollInterval) + continue + } + wc.logger.Panic("BUG: List returned items with empty/zero revision. Watch would be inconsistent.") } wc.currentWatchRevision = l.Revision