{"record":{"id":"de05ccae92fd51f0","repo":"kovidgoyal/kitty","slug":"unknown-change-type-v","errorCode":null,"errorMessage":"Unknown change type: %#v","messagePattern":"Unknown change type: %#v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/diff/render.go","lineNumber":874,"sourceCode":"\t\t\tif is_binary {\n\t\t\t\tif is_img {\n\t\t\t\t\tans, err = image_lines(path, \"\", screen_size, margin_size, image_size, ans)\n\t\t\t\t} else {\n\t\t\t\t\tans, err = binary_lines(path, \"\", columns, margin_size, ans)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tans, err = all_lines(path, columns, margin_size, false, ans)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase \"rename\":\n\t\t\tans, err = rename_lines(path, changed_path, columns, margin_size, ans)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"Unknown change type: %#v\", item_type)\n\t\t}\n\t\treturn nil\n\t})\n\tvar ll []*LogicalLine\n\tif len(ans) > 1 {\n\t\tll = ans[:len(ans)-1]\n\t} else {\n\t\t// Having am empty list of lines causes panics later on\n\t\tll = []*LogicalLine{{line_type: EMPTY_LINE, screen_lines: []*ScreenLine{{}}}}\n\t}\n\treturn &LogicalLines{lines: ll, title_line_indices: title_line_indices, margin_size: margin_size, columns: columns}, err\n}\n","sourceCodeStart":856,"sourceCodeEnd":887,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/diff/render.go#L856-L887","documentation":"While rendering directory-diff entries, render.go dispatches on each changed item's type string; any value other than the recognized kinds (e.g. 'add', 'remove', 'change', 'rename') reaches the default branch and raises this error with the %#v-formatted type. It indicates the collection of changes contains an entry type the renderer does not know.","triggerScenarios":"A change collection (typically produced from git status parsing or similar) containing an unexpected type string such as 'copy', 'typechange', or an empty/garbage value; extension or newer kitty versions producing types this build's renderer can't handle; custom code feeding render() its own collection.","commonSituations":"Version skew between components generating the change list and the renderer; git reporting 'T' (typechange) or 'C' (copy) entries that fall outside the handled set; third-party tools reusing the kitten's render API with richer type vocabularies.","solutions":["Identify the offending item type from the %#v value in the message.","If it comes from git metadata, refresh/regenerate the change list (git status) and retry; typechange entries can be normalized to remove+add.","Update kitty to the latest version in case the type is newly supported.","If calling render() directly, map your change types onto the supported set before rendering."],"exampleFix":"// before\ncollection.Add(\"copy\", oldPath, newPath)\n\n// after\ncollection.Add(\"add\", \"\", newPath)\ncollection.Add(\"remove\", oldPath, \"\")","handlingStrategy":"type-guard","validationCode":"// Go: whitelist change types before handing a collection to render()\nallowed := map[string]bool{\"add\": true, \"remove\": true, \"change\": true, \"rename\": true}\nfor _, it := range collection.Items {\n    if !allowed[it.Type] {\n        return fmt.Errorf(\"unsupported change type %q; map it to add/remove\", it.Type)\n    }\n}","typeGuard":"func isSupportedChangeType(t string) bool {\n    switch t {\n    case \"add\", \"remove\", \"change\", \"rename\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"On 'Unknown change type', extract the %#v value from the message, normalize the entry (e.g. copy/typechange -> remove+add), and re-render; log unhandled values for upstream reporting.","preventionTips":["Map external VCS status codes onto the supported type set before rendering.","Regenerate git status data if it may be stale or corrupt.","Keep kitty updated so newly supported types render natively."],"tags":["kitty","diff-kitten","rendering","enum-dispatch","directory-diff"],"backgroundTag":"unhandled-enum-value","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}