{"record":{"id":"576b804c0f92c94a","repo":"derailed/k9s","slug":"expecting-screendumper-but-got-t","errorCode":null,"errorMessage":"expecting screendumper, but got %T","messagePattern":"expecting screendumper, but got %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/render/screen_dump.go","lineNumber":45,"sourceCode":"\t\treturn tcell.ColorNavajoWhite\n\t}\n}\n\n// Header returns a header row.\nfunc (ScreenDump) Header(string) model1.Header {\n\treturn model1.Header{\n\t\tmodel1.HeaderColumn{Name: \"NAME\"},\n\t\tmodel1.HeaderColumn{Name: \"DIR\"},\n\t\tmodel1.HeaderColumn{Name: \"VALID\", Attrs: model1.Attrs{Wide: true}},\n\t\tmodel1.HeaderColumn{Name: \"AGE\", Attrs: model1.Attrs{Time: true}},\n\t}\n}\n\n// Render renders a K8s resource to screen.\nfunc (ScreenDump) Render(o any, _ string, r *model1.Row) error {\n\tf, ok := o.(FileRes)\n\tif !ok {\n\t\treturn fmt.Errorf(\"expecting screendumper, but got %T\", o)\n\t}\n\n\tr.ID = filepath.Join(f.Dir, f.File.Name())\n\tr.Fields = model1.Fields{\n\t\tf.File.Name(),\n\t\tf.Dir,\n\t\t\"\",\n\t\ttimeToAge(f.File.ModTime()),\n\t}\n\n\treturn nil\n}\n\n// ----------------------------------------------------------------------------\n// Helpers...\n\nfunc timeToAge(timestamp time.Time) string {\n\treturn duration.HumanDuration(time.Since(timestamp))","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/render/screen_dump.go#L27-L63","documentation":"ScreenDump.Render lists screen-dump files and requires a render.FileRes value — {File os.FileInfo, Dir string} — which the screendumps browser builds from directory scans. The comma-ok assertion matches the value type, so a *FileRes pointer, a bare os.FileInfo, or any other payload fails with this error printing the concrete %T.","triggerScenarios":"Calling ScreenDump{}.Render with &FileRes{...}, an os.FileInfo alone, or a path string; custom views reusing the screendumps renderer for non-file rows; refactors that change the file walker's output type.","commonSituations":"Adding plugins that list local files as resources; changing where screen dumps are stored and the walker that enumerates them; test fixtures using pointers.","solutions":["Pass render.FileRes by value (FileRes{File: info, Dir: dir})","Bind the ScreenDump renderer only to the screendumps view","Use the comma-ok form in wrappers and skip mismatches","Log the %T from the error to find the offending producer"],"exampleFix":"// before\nerr := sdRenderer.Render(&render.FileRes{File: info, Dir: dir}, ns, row)\n// after\nerr := sdRenderer.Render(render.FileRes{File: info, Dir: dir}, ns, row)","handlingStrategy":"type-guard","validationCode":"// gate before invoking the screendumps renderer\nif _, ok := o.(render.FileRes); !ok {\n\treturn fmt.Errorf(\"screendumps view requires render.FileRes value, got %T\", o)\n}\nerr := sdRenderer.Render(o, ns, row)","typeGuard":"func isFileRes(o any) bool {\n\t_, ok := o.(render.FileRes)\n\treturn ok\n}","tryCatchPattern":"if err := sdRenderer.Render(o, ns, row); err != nil {\n\tslog.Warn(\"screendump row skipped\", \"type\", fmt.Sprintf(\"%T\", o), slogs.Error, err)\n\treturn nil // drop the row, keep the view alive\n}","preventionTips":["ScreenDump.Render asserts the value type: pass FileRes, not *FileRes or a bare os.FileInfo","Keep file walkers emitting FileRes values","Bind the ScreenDump renderer only to the screendumps view","Use comma-ok assertions at custom call sites"],"tags":["go","type-assertion","screendumps","filesystem","renderer","k9s"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}