{"record":{"id":"d1e78b8a9efc6389","repo":"amir20/dozzle","slug":"no-namespaces-to-watch","errorCode":null,"errorMessage":"no namespaces to watch","messagePattern":"no namespaces to watch","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/k8s/client.go","lineNumber":582,"sourceCode":"\t\tTimestamps: true,\n\t\tSinceTime:  &metav1.Time{Time: start},\n\t}\n\n\treturn k.Clientset.CoreV1().Pods(namespace).GetLogs(podName, opts).Stream(ctx)\n}\n\nfunc (k *K8sClient) ContainerEvents(ctx context.Context, ch chan<- container.ContainerEvent) error {\n\twatchers := lo.Map(k.namespace, func(namespace string, index int) watch.Interface {\n\t\twatcher, err := k.Clientset.CoreV1().Pods(namespace).Watch(ctx, metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\tlog.Error().Err(err).Msg(\"Failed to watch pods\")\n\t\t\treturn nil\n\t\t}\n\t\treturn watcher\n\t})\n\n\tif len(watchers) == 0 {\n\t\treturn errors.New(\"no namespaces to watch\")\n\t}\n\n\twg := sync.WaitGroup{}\n\n\tfor _, watcher := range watchers {\n\t\twg.Go(func() {\n\t\t\tfor event := range watcher.ResultChan() {\n\t\t\t\tlog.Debug().Interface(\"event.type\", event.Type).Msg(\"Received kubernetes event\")\n\t\t\t\tpod, ok := event.Object.(*corev1.Pod)\n\t\t\t\tif !ok {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tname := \"\"\n\t\t\t\tswitch event.Type {\n\t\t\t\tcase \"ADDED\":\n\t\t\t\t\tname = \"create\"\n\t\t\t\tcase \"DELETED\":","sourceCodeStart":564,"sourceCodeEnd":600,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/internal/k8s/client.go#L564-L600","documentation":"ContainerEvents returns this error when it could not build any namespace watchers, so there is nothing to watch for pod/container events. It is raised when the pre-built watcher list is empty after iterating the configured namespaces (internal/k8s/client.go:582).","triggerScenarios":"Calling ContainerEvents on a k8s client where every namespace failed to produce a watcher — e.g. no namespaces resolved/configured, or all watcher constructions were skipped before the len(watchers)==0 guard.","commonSituations":"Running Dozzle in k8s mode in a cluster/namespace context where the service account can't see any namespace or the namespace list is empty; misconfigured namespace restriction excluding everything; RBAC so limited that watcher setup yields nothing.","solutions":["Check which namespaces the client was configured with and ensure at least one is valid/watchable.","Verify RBAC: the service account needs list/watch on pods (and namespaces) — kubectl auth can-i list pods -n <ns>.","Run kubectl get namespaces to confirm the cluster actually has accessible namespaces from Dozzle's context.","If you restrict namespaces via config, make sure the configured names exist and are not filtered out."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"kubectl auth can-i list pods --all-namespaces --as=system:serviceaccount:<ns>:dozzle\nkubectl get namespaces","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure at least one watchable namespace is configured in k8s mode","Grant the service account list/watch RBAC on pods and namespaces","Confirm cluster connectivity and context before starting Dozzle","Log the namespace list used to build watchers for diagnosis"],"tags":["kubernetes","configuration","empty-result"],"backgroundTag":"empty-result-set","analyzedSha":"d9463cbe21874e44ab79db6fa63e746ca7d22928","analyzedAt":"2026-09-07T10:08:55.855Z","contentChangedAt":"2026-09-07T10:08:55.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}