{"record":{"id":"88664d716dbee078","repo":"crowdsecurity/crowdsec","slug":"cache-sync-failed-for-namespace-q-selector-q","errorCode":null,"errorMessage":"cache sync failed for namespace=%q selector=%q","messagePattern":"cache sync failed for namespace=%q selector=%q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/kubernetes/run.go","lineNumber":167,"sourceCode":"\t\t\t}\n\n\t\t\tif pod != nil {\n\t\t\t\ts.stopPod(pod)\n\t\t\t}\n\t\t},\n\t})\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while adding event handler for namespace=%q selector=%q: %w\", s.config.Namespace, s.config.Selector, err)\n\t}\n\tf.Start(informerCtx.Done())\n\tif !cache.WaitForCacheSync(informerCtx.Done(), inf.HasSynced) {\n\t\tselect {\n\t\tcase watchErr := <-watchErrCh:\n\t\t\treturn watchErr\n\t\tdefault:\n\t\t}\n\t\treturn fmt.Errorf(\"cache sync failed for namespace=%q selector=%q\", s.config.Namespace, s.config.Selector)\n\t}\n\n\tselect {\n\tcase <-ctx.Done():\n\tcase watchErr := <-watchErrCh:\n\t\ts.stopPods()\n\t\twg.Wait()\n\t\treturn watchErr\n\t}\n\ts.stopPods()\n\twg.Wait()\n\n\treturn nil\n}\n\nfunc (s *Source) Dump() any {\n\treturn s\n}","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/kubernetes/run.go#L149-L185","documentation":"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.","triggerScenarios":"Thrown at pkg/acquisition/modules/kubernetes/run.go:167 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}