{"record":{"id":"bdb784b57d307b00","repo":"matplotlib/matplotlib","slug":"invalid-hex-color-specifier-orig-c-r","errorCode":null,"errorMessage":"Invalid hex color specifier: {orig_c!r}","messagePattern":"Invalid hex color specifier: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/matplotlib/colors.py","lineNumber":409,"sourceCode":"        if re.fullmatch(\"#[a-fA-F0-9]+\", c):\n            if len(c) == 7:  # #rrggbb hex format.\n                return (*[n / 0xff for n in bytes.fromhex(c[1:])],\n                        alpha if alpha is not None else 1.)\n            elif len(c) == 4:  # #rgb hex format, shorthand for #rrggbb.\n                return (*[int(n, 16) / 0xf for n in c[1:]],\n                        alpha if alpha is not None else 1.)\n            elif len(c) == 9:  # #rrggbbaa hex format.\n                color = [n / 0xff for n in bytes.fromhex(c[1:])]\n                if alpha is not None:\n                    color[-1] = alpha\n                return tuple(color)\n            elif len(c) == 5:  # #rgba hex format, shorthand for #rrggbbaa.\n                color = [int(n, 16) / 0xf for n in c[1:]]\n                if alpha is not None:\n                    color[-1] = alpha\n                return tuple(color)\n            else:\n                raise ValueError(f\"Invalid hex color specifier: {orig_c!r}\")\n        # string gray.\n        try:\n            c = float(c)\n        except ValueError:\n            pass\n        else:\n            if not (0 <= c <= 1):\n                raise ValueError(\n                    f\"Invalid string grayscale value {orig_c!r}. \"\n                    f\"Value must be within 0-1 range\")\n            return c, c, c, alpha if alpha is not None else 1.\n        raise ValueError(f\"Invalid RGBA argument: {orig_c!r}\")\n    # turn 2-D array into 1-D array\n    if isinstance(c, np.ndarray):\n        if c.ndim == 2 and c.shape[0] == 1:\n            c = c.reshape(-1)\n    # tuple color.\n    if not np.iterable(c):","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/matplotlib/matplotlib/blob/b379c1b69e012b142c0f496a52bcb30513802d72/lib/matplotlib/colors.py#L391-L427","documentation":"Error \"Invalid hex color specifier: {orig_c!r}\" thrown in matplotlib/matplotlib.","triggerScenarios":"Thrown at lib/matplotlib/colors.py:409 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"}