{"record":{"id":"65c92c09d7a42f17","repo":"matplotlib/matplotlib","slug":"unknown-artist-properties-s","errorCode":null,"errorMessage":"Unknown artist properties: %s","messagePattern":"Unknown artist properties: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"lib/matplotlib/rcsetup.py","lineNumber":936,"sourceCode":"    raise ValueError(f\"{loc} is not a valid legend location.\")\n\n\ndef validate_cycler(s):\n    \"\"\"Return a Cycler object from a string repr or the object itself.\"\"\"\n    if isinstance(s, str):\n        try:\n            s = _parse_cycler_string(s)\n        except Exception as e:\n            raise ValueError(f\"{s!r} is not a valid cycler construction: {e}\"\n                             ) from e\n    if isinstance(s, Cycler):\n        cycler_inst = s\n    else:\n        raise ValueError(f\"Object is not a string or Cycler instance: {s!r}\")\n\n    unknowns = cycler_inst.keys - (set(_prop_validators) | set(_prop_aliases))\n    if unknowns:\n        raise ValueError(\"Unknown artist properties: %s\" % unknowns)\n\n    # Not a full validation, but it'll at least normalize property names\n    # A fuller validation would require v0.10 of cycler.\n    checker = set()\n    for prop in cycler_inst.keys:\n        norm_prop = _prop_aliases.get(prop, prop)\n        if norm_prop != prop and norm_prop in cycler_inst.keys:\n            raise ValueError(f\"Cannot specify both {norm_prop!r} and alias \"\n                             f\"{prop!r} in the same prop_cycle\")\n        if norm_prop in checker:\n            raise ValueError(f\"Another property was already aliased to \"\n                             f\"{norm_prop!r}. Collision normalizing {prop!r}.\")\n        checker.update([norm_prop])\n\n    # This is just an extra-careful check, just in case there is some\n    # edge-case I haven't thought of.\n    assert len(checker) == len(cycler_inst.keys)\n","sourceCodeStart":918,"sourceCodeEnd":954,"githubUrl":"https://github.com/matplotlib/matplotlib/blob/b379c1b69e012b142c0f496a52bcb30513802d72/lib/matplotlib/rcsetup.py#L918-L954","documentation":"After validate_cycler() (lib/matplotlib/rcsetup.py:936) obtains a Cycler (from a string or directly), it checks that every key is a known artist property: keys must be a subset of _prop_validators | _prop_aliases. Unknown keys raise ValueError listing them. This is the same whitelist that cycler() enforces, applied when you assign a pre-built Cycler or a string to rcParams['axes.prop_cycle'].","triggerScenarios":"mpl.rcParams['axes.prop_cycle'] = cycler.cycler(foo=['a','b']) (raw cycler package, no validation); a Cycler built with a typo'd key then assigned to rcParams; string form \"cycler(colour='rgb')\".","commonSituations":"Bypassing matplotlib.cycler by importing cycler.cycler directly, which skips validation at build time so the failure surfaces later at rcParams assignment; merging palette dicts from other tools that use non-Artist keys.","solutions":["Use from matplotlib import cycler (the validating wrapper) so bad keys fail at build time with a clearer error","Rename the key to a valid property or alias (color, lw, ls, fc, ec, mfc, mec, mew, ms, ...)","Inspect the whitelist: from matplotlib.rcsetup import _prop_validators, _prop_aliases"],"exampleFix":"# before\nfrom cycler import cycler\nmpl.rcParams['axes.prop_cycle'] = cycler(colour=['r', 'g', 'b'])\n# after\nfrom matplotlib import cycler\nmpl.rcParams['axes.prop_cycle'] = cycler(color=['r', 'g', 'b'])","handlingStrategy":"validation","validationCode":"from matplotlib.rcsetup import _prop_validators, _prop_aliases\nKNOWN = set(_prop_validators) | set(_prop_aliases)\ncyc = cycler.cycler(**cfg)\nunknown = cyc.keys - KNOWN\nif unknown:\n    raise ValueError(f'unknown artist properties: {sorted(unknown)}')\nmpl.rcParams['axes.prop_cycle'] = cyc","typeGuard":"from matplotlib.rcsetup import _prop_validators, _prop_aliases\ndef has_only_known_props(cyc):\n    return cyc.keys <= (set(_prop_validators) | set(_prop_aliases))","tryCatchPattern":"try:\n    mpl.rcParams['axes.prop_cycle'] = cyc\nexcept ValueError as e:\n    if 'Unknown artist properties' in str(e):\n        mpl.rcParams['axes.prop_cycle'] = cycler(color=list(cyc.by_key().values())[0])\n    else:\n        raise","preventionTips":["Always build with matplotlib.cycler so keys are validated at build time","Check keys against _prop_validators | _prop_aliases when importing palettes","Fail on unknown keys in config loaders instead of dropping silently"],"tags":["matplotlib","rcsetup","cycler","prop-cycle","validation"],"backgroundTag":"unknown-property-name","analyzedSha":"b379c1b69e012b142c0f496a52bcb30513802d72","analyzedAt":"2026-08-21T23:31:55.468Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}