{"record":{"id":"9aae22a28f4f3784","repo":"matplotlib/matplotlib","slug":"tz-must-be-string-or-tzinfo-subclass-not-tz-r","errorCode":null,"errorMessage":"tz must be string or tzinfo subclass, not {tz!r}.","messagePattern":"tz must be string or tzinfo subclass, not (.+?)\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"lib/matplotlib/dates.py","lineNumber":224,"sourceCode":"\n\ndef _get_tzinfo(tz=None):\n    \"\"\"\n    Generate `~datetime.tzinfo` from a string or return `~datetime.tzinfo`.\n    If None, retrieve the preferred timezone from the rcParams dictionary.\n    \"\"\"\n    tz = mpl._val_or_rc(tz, 'timezone')\n    if tz == 'UTC':\n        return UTC\n    if isinstance(tz, str):\n        tzinfo = dateutil.tz.gettz(tz)\n        if tzinfo is None:\n            raise ValueError(f\"{tz} is not a valid timezone as parsed by\"\n                             \" dateutil.tz.gettz.\")\n        return tzinfo\n    if isinstance(tz, datetime.tzinfo):\n        return tz\n    raise TypeError(f\"tz must be string or tzinfo subclass, not {tz!r}.\")\n\n\n# Time-related constants.\nEPOCH_OFFSET = float(datetime.datetime(1970, 1, 1).toordinal())\n# EPOCH_OFFSET is not used by matplotlib\nMICROSECONDLY = SECONDLY + 1\nHOURS_PER_DAY = 24.\nMIN_PER_HOUR = 60.\nSEC_PER_MIN = 60.\nMONTHS_PER_YEAR = 12.\n\nDAYS_PER_WEEK = 7.\nDAYS_PER_MONTH = 30.\nDAYS_PER_YEAR = 365.0\n\nMINUTES_PER_DAY = MIN_PER_HOUR * HOURS_PER_DAY\n\nSEC_PER_HOUR = SEC_PER_MIN * MIN_PER_HOUR","sourceCodeStart":206,"sourceCodeEnd":242,"githubUrl":"https://github.com/matplotlib/matplotlib/blob/b379c1b69e012b142c0f496a52bcb30513802d72/lib/matplotlib/dates.py#L206-L242","documentation":"Error \"tz must be string or tzinfo subclass, not {tz!r}.\" thrown in matplotlib/matplotlib.","triggerScenarios":"Thrown at lib/matplotlib/dates.py:224 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"}