{"record":{"id":"31c599b99c3e9b56","repo":"matplotlib/matplotlib","slug":"tfm-checksum-mismatch-n","errorCode":null,"errorMessage":"tfm checksum mismatch: {n}","messagePattern":"tfm checksum mismatch: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/matplotlib/dviread.py","lineNumber":538,"sourceCode":"            self.fonts[k] = DviFont.from_luatex(s, n)\n            return\n        fontname = fontname.decode(\"ascii\")\n        try:\n            tfm = _tfmfile(fontname)\n        except FileNotFoundError as exc:\n            if fontname.startswith(\"[\") and fontname.endswith(\";\") and c == 0:\n                exc.add_note(\n                    \"This dvi file was likely generated with a too-old \"\n                    \"version of luaotfload; luaotfload 3.23 is required.\")\n            # Explicitly allow defining missing fonts for Vf support; we only\n            # register an error when trying to load a glyph from a missing font\n            # and throw that error in Dvi._read.  For Vf, _finalize_packet\n            # checks whether a missing glyph has been used, and in that case\n            # skips the glyph definition.\n            self.fonts[k] = cbook._ExceptionInfo.from_exception(exc)\n            return\n        if c != 0 and tfm.checksum != 0 and c != tfm.checksum:\n            raise ValueError(f'tfm checksum mismatch: {n}')\n        try:\n            vf = _vffile(fontname)\n        except FileNotFoundError:\n            vf = None\n        self.fonts[k] = DviFont(scale=s, metrics=tfm, texname=n, vf=vf)\n\n    @_dispatch(247, state=_dvistate.pre, args=('u1', 'u4', 'u4', 'u4', 'u1'))\n    def _pre(self, i, num, den, mag, k):\n        self.file.read(k)  # comment in the dvi file\n        if i not in [2, 7]:  # 2: pdftex, luatex; 7: xetex\n            raise ValueError(f\"Unknown dvi format {i}\")\n        if num != 25400000 or den != 7227 * 2**16:\n            raise ValueError(\"Nonstandard units in dvi file\")\n            # meaning: TeX always uses those exact values, so it\n            # should be enough for us to support those\n            # (There are 72.27 pt to an inch so 7227 pt =\n            # 7227 * 2**16 sp to 100 in. The numerator is multiplied\n            # by 10^5 to get units of 10**-7 meters.)","sourceCodeStart":520,"sourceCodeEnd":556,"githubUrl":"https://github.com/matplotlib/matplotlib/blob/b379c1b69e012b142c0f496a52bcb30513802d72/lib/matplotlib/dviread.py#L520-L556","documentation":"Error \"tfm checksum mismatch: {n}\" thrown in matplotlib/matplotlib.","triggerScenarios":"Thrown at lib/matplotlib/dviread.py:538 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b379c1b69e012b142c0f496a52bcb30513802d72","analyzedAt":"2026-08-21T23:31:55.468Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}