{"record":{"id":"cf0ce9dba18ecfa4","repo":"Textualize/textual","slug":"cannot-mix-none-with-other-style-flags","errorCode":null,"errorMessage":"cannot mix 'none' with other style flags","messagePattern":"cannot mix 'none' with other style flags","errorType":"validation","errorClass":"StyleValueError","httpStatus":null,"severity":"error","filePath":"src/textual/css/_style_properties.py","lineNumber":1104,"sourceCode":"        elif isinstance(style_flags, Style):\n            if obj.set_rule(self.name, style_flags):\n                obj.refresh(children=True)\n        else:\n            words = [word.strip() for word in style_flags.split(\" \")]\n            valid_word = VALID_STYLE_FLAGS.__contains__\n            for word in words:\n                if not valid_word(word):\n                    raise StyleValueError(\n                        f\"unknown word {word!r} in style flags\",\n                        help_text=style_flags_property_help_text(\n                            self.name, word, context=\"inline\"\n                        ),\n                    )\n            try:\n                style = Style.parse(style_flags)\n            except rich.errors.StyleSyntaxError as error:\n                if \"none\" in words and len(words) > 1:\n                    raise StyleValueError(\n                        \"cannot mix 'none' with other style flags\",\n                        help_text=style_flags_property_help_text(\n                            self.name, \" \".join(words), context=\"inline\"\n                        ),\n                    ) from None\n                raise error from None\n            if obj.set_rule(self.name, style):\n                obj.refresh(children=True)\n\n\nclass TransitionsProperty:\n    \"\"\"Descriptor for getting transitions properties\"\"\"\n\n    def __get__(\n        self, obj: StylesBase, objtype: type[StylesBase] | None = None\n    ) -> dict[str, Transition]:\n        \"\"\"Get a mapping of properties to the transitions applied to them.\n","sourceCodeStart":1086,"sourceCodeEnd":1122,"githubUrl":"https://github.com/Textualize/textual/blob/06dbeef4bb70fb718236aa418ed658ef4667a126/src/textual/css/_style_properties.py#L1086-L1122","documentation":"When StyleFlagsProperty hands a multi-word value to rich's Style.parse and it fails, and the words include 'none' alongside others, this clearer StyleValueError replaces rich's generic syntax error. 'none' is a standalone flag meaning no styling and cannot be combined with bold, italic, etc.","triggerScenarios":"`styles.text_style = \"none bold\"`, `styles.text_style = \"italic none\"`, or `text-style: bold none;` in a stylesheet.","commonSituations":"Dynamically composing style flags and concatenating a default 'none' with user-chosen flags; misunderstanding 'none' as a resettable default.","solutions":["Remove 'none' when other flags are present, or use 'none' alone","When building flags programmatically, filter out 'none' if any other flag is set"],"exampleFix":"# before\nstyles.text_style = \"none bold\"\n# after\nstyles.text_style = \"bold\"","handlingStrategy":"validation","validationCode":"words = [w for w in flags.split() if w != \"none\"] or [\"none\"]\nstyles.text_style = \" \".join(words)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never concatenate 'none' with other flags when composing styles dynamically"],"tags":["textual","css","text-style","mutual-exclusion"],"backgroundTag":"invalid-css-value","analyzedSha":"06dbeef4bb70fb718236aa418ed658ef4667a126","analyzedAt":"2026-08-27T02:36:57.214Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}