crowdsecurity/crowdsec · error
cache sync failed for namespace=%q selector=%q
Error message
cache sync failed for namespace=%q selector=%q
What it means
Stream fails when the informer cache never syncs (WaitForCacheSync returns false), typically because the API server is unreachable, credentials are denied, or the context was cancelled; datasource start aborts.
Source
Thrown at pkg/acquisition/modules/kubernetes/run.go:167
}
if pod != nil {
s.stopPod(pod)
}
},
})
if err != nil {
return fmt.Errorf("while adding event handler for namespace=%q selector=%q: %w", s.config.Namespace, s.config.Selector, err)
}
f.Start(informerCtx.Done())
if !cache.WaitForCacheSync(informerCtx.Done(), inf.HasSynced) {
select {
case watchErr := <-watchErrCh:
return watchErr
default:
}
return fmt.Errorf("cache sync failed for namespace=%q selector=%q", s.config.Namespace, s.config.Selector)
}
select {
case <-ctx.Done():
case watchErr := <-watchErrCh:
s.stopPods()
wg.Wait()
return watchErr
}
s.stopPods()
wg.Wait()
return nil
}
func (s *Source) Dump() any {
return s
}View on GitHub (pinned to 909b515798)
Solutions
- Check connectivity to the API server and RBAC list/watch permissions on pods
- Look earlier in logs for a preceding Unauthorized error
- Restart the datasource once the API server is reachable
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at pkg/acquisition/modules/kubernetes/run.go:167 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/88664d716dbee078.
Report an issue: GitHub.