{"record":{"id":"76940636bacb619e","repo":"kovidgoyal/kitty","slug":"failed-to-convert-src-path-to-rgba-data-no-outp","errorCode":null,"errorMessage":"Failed to convert {src_path} to RGBA data, no output written. stderr: {cp.stderr.decode(\"utf-8\", \"replace\")}","messagePattern":"Failed to convert (.+?) to RGBA data, no output written\\. stderr: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"kitty/render_cache.py","lineNumber":78,"sourceCode":"        entries.sort(key=sort_key, reverse=True)\n        for e in entries[self.max_entries :]:\n            with suppress(FileNotFoundError):\n                os.remove(e.path)\n\n    def touch(self, path: str) -> None:\n        os.utime(path, follow_symlinks=False)\n\n    def render_image(self, src_path: str, output_path: str) -> None:\n        import stat\n        import subprocess\n\n        try:\n            with open(src_path, 'rb') as src, open(output_path, 'wb', opener=partial(os.open, mode=stat.S_IREAD | stat.S_IWRITE)) as output:\n                cp = subprocess.run([kitten_exe(), '__convert_image__', 'RGBA'], stdin=src, stdout=output, stderr=subprocess.PIPE)\n                if cp.returncode != 0:\n                    raise ValueError(f'Failed to convert {src_path} to RGBA data with error: {cp.stderr.decode(\"utf-8\", \"replace\")}')\n                if output.seek(0, os.SEEK_END) < 8:\n                    raise ValueError(f'Failed to convert {src_path} to RGBA data, no output written. stderr: {cp.stderr.decode(\"utf-8\", \"replace\")}')\n        except Exception:\n            with suppress(Exception):\n                os.unlink(output_path)\n            raise\n\n    def read_metadata(self, output_path: str) -> tuple[int, int, int]:\n        with open(output_path, 'rb') as f:\n            header = f.read(8)\n            import struct\n\n            width, height = struct.unpack('<II', header)\n            f.seek(0)\n            return width, height, os.dup(f.fileno())\n\n    def render(self, src_path: str) -> str:\n        import struct\n        from hashlib import sha256\n","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/render_cache.py#L60-L96","documentation":"The conversion subprocess exited 0 but wrote fewer than 8 bytes of RGBA output, so the data is unusable; stderr is included if present.","triggerScenarios":"A kitten __convert_image__ invocation that succeeds silently but produces (almost) no output — empty stdin, degenerate 0-pixel image, or plugin/codec issue.","commonSituations":"Passing an empty or pathological image file (0x0 dimensions) into the render cache.","solutions":["Check the source file is non-empty and has valid dimensions","Re-save the image with an image editor or 'magick' to normalize it","Report a bug if a well-formed image triggers it on your kitty version"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import os\nassert os.path.getsize(src_path) > 0","typeGuard":null,"tryCatchPattern":"except ValueError: skip degenerate image and continue batch","preventionTips":["Filter zero-byte/0-dimension images upstream"],"tags":["kitty","image","empty-output"],"backgroundTag":"image-decode-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}