{"record":{"id":"eb3e744be4f5c3cd","repo":"derailed/k9s","slug":"resource-s-is-not-loggable","errorCode":null,"errorMessage":"resource %s is not Loggable","messagePattern":"resource (.+?) is not Loggable","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/model/log.go","lineNumber":225,"sourceCode":"}\n\nfunc (l *Log) cancel() {\n\tl.mx.Lock()\n\tdefer l.mx.Unlock()\n\tif l.cancelFn != nil {\n\t\tl.cancelFn()\n\t\tl.cancelFn = nil\n\t}\n}\n\nfunc (l *Log) load(ctx context.Context) error {\n\taccessor, err := dao.AccessorFor(l.factory, l.gvr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tloggable, ok := accessor.(dao.Loggable)\n\tif !ok {\n\t\treturn fmt.Errorf(\"resource %s is not Loggable\", l.gvr)\n\t}\n\n\tl.cancel()\n\tctx = context.WithValue(ctx, internal.KeyFactory, l.factory)\n\tctx, l.cancelFn = context.WithCancel(ctx)\n\n\tcc, err := loggable.TailLogs(ctx, l.logOptions)\n\tif err != nil {\n\t\tslog.Error(\"Tail logs failed\", slogs.Error, err)\n\t\tl.cancel()\n\t\tl.fireLogError(err)\n\t}\n\tfor _, c := range cc {\n\t\tgo l.updateLogs(ctx, c)\n\t}\n\n\treturn nil\n}","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/model/log.go#L207-L243","documentation":"Log.load fetches the DAO accessor for a GVR and type-asserts it to dao.Loggable (TailLogs). Resources whose DAO does not implement Loggable cannot stream logs, so the log model aborts before creating any watcher.","triggerScenarios":"Opening a log view (pressing 'l') on a resource that has no log semantics: Namespace, ConfigMap, Service without pods, Node, RBAC objects, CRDs — anything whose accessor lacks a TailLogs method.","commonSituations":"Muscle-memory pressing the log shortcut while browsing non-workload resources; custom views binding the log command to unsupported GVRs.","solutions":["Invoke logs on pod-capable resources: Pod, Deployment, StatefulSet, DaemonSet, Job, CronJob (and containers inside them)","If a custom resource should support logs, implement dao.Loggable (TailLogs) on its accessor","Check keyboard mappings / command alias so the log key is not bound for non-loggable views"],"exampleFix":"// before: log request on a ConfigMap accessor\nloggable, ok := accessor.(dao.Loggable) // ok == false\n\n// after: guard before streaming\nif loggable, ok := accessor.(dao.Loggable); ok {\n    cc, err := loggable.TailLogs(ctx, opts)\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func loggableFor(factory dao.Factory, gvr *client.GVR) (dao.Loggable, bool) {\n    accessor, err := dao.AccessorFor(factory, gvr)\n    if err != nil { return nil, false }\n    l, ok := accessor.(dao.Loggable)\n    return l, ok\n}","tryCatchPattern":"err := l.load(ctx)\nif err != nil && strings.Contains(err.Error(), \"is not Loggable\") {\n    // disable the log view for this GVR rather than flashing an error\n    return disableLogsFor(gvr)\n}","preventionTips":["Bind the log shortcut only for pod-backed GVRs (pods, deployments, sts, ds, jobs)","Cache per-GVR capability checks (Loggable/Describer/Valuer) at startup instead of failing at click time"],"tags":["kubernetes","logs","interface","dao","k9s"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}