{"record":{"id":"9894e126fceaff9c","repo":"matplotlib/matplotlib","slug":"n-err-explain-0","errorCode":null,"errorMessage":"\"\\n\" + err.explain(0)","messagePattern":"\"\\\\n\" \\+ err\\.explain\\(0\\)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/matplotlib/_mathtext.py","lineNumber":2350,"sourceCode":"        self._math_expression = p.math\n\n        # To add space to nucleus operators after sub/superscripts\n        self._needs_space_after_subsuper = False\n\n    def parse(self, s: str, fonts_object: Fonts, fontsize: float, dpi: float) -> Hlist:\n        \"\"\"\n        Parse expression *s* using the given *fonts_object* for\n        output, at the given *fontsize* and *dpi*.\n\n        Returns the parse tree of `Node` instances.\n        \"\"\"\n        self._state_stack = [\n            ParserState(fonts_object, 'default', 'rm', fontsize, dpi)]\n        self._em_width_cache: dict[tuple[str, float, float], float] = {}\n        try:\n            result = self._expression.parse_string(s)\n        except ParseBaseException as err:\n            raise ValueError(\"\\n\" + err.explain(0)) from None\n        self._state_stack = []\n        self._needs_space_after_subsuper = False\n        # prevent operator spacing from leaking into a new expression\n        self._em_width_cache = {}\n        ParserElement.reset_cache()\n        return T.cast(Hlist, result[0])  # Known return type from main.\n\n    def get_state(self) -> ParserState:\n        \"\"\"Get the current `State` of the parser.\"\"\"\n        return self._state_stack[-1]\n\n    def pop_state(self) -> None:\n        \"\"\"Pop a `State` off of the stack.\"\"\"\n        self._state_stack.pop()\n\n    def push_state(self) -> None:\n        \"\"\"Push a new `State` onto the stack, copying the current state.\"\"\"\n        self._state_stack.append(self.get_state().copy())","sourceCodeStart":2332,"sourceCodeEnd":2368,"githubUrl":"https://github.com/matplotlib/matplotlib/blob/b379c1b69e012b142c0f496a52bcb30513802d72/lib/matplotlib/_mathtext.py#L2332-L2368","documentation":"Error \"\"\\n\" + err.explain(0)\" thrown in matplotlib/matplotlib.","triggerScenarios":"Thrown at lib/matplotlib/_mathtext.py:2350 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"}