{"record":{"id":"41a3c5faac9d4e25","repo":"Textualize/textual","slug":"self-name-must-be-one-of-friendly-list-self-va","errorCode":null,"errorMessage":"{self.name} must be one of {friendly_list(self._valid_values)} (received {value!r})","messagePattern":"(.+?) must be one of (.+?) \\(received (.+?)\\)","errorType":"validation","errorClass":"StyleValueError","httpStatus":null,"severity":"error","filePath":"src/textual/css/_style_properties.py","lineNumber":859,"sourceCode":"        \"\"\"\n        _rich_traceback_omit = True\n        if value is None:\n            if obj.clear_rule(self.name):\n                self._before_refresh(obj, value)\n                obj.refresh(\n                    layout=self._layout,\n                    children=self._refresh_children,\n                    parent=self._refresh_parent,\n                )\n\n                if self._display:\n                    node = obj.node\n                    if node is not None and node.parent:\n                        node._nodes.updated()\n\n        else:\n            if value not in self._valid_values:\n                raise StyleValueError(\n                    f\"{self.name} must be one of {friendly_list(self._valid_values)} (received {value!r})\",\n                    help_text=string_enum_help_text(\n                        self.name,\n                        valid_values=list(self._valid_values),\n                        context=\"inline\",\n                    ),\n                )\n            if obj.set_rule(self.name, value):\n                if self._display and obj.node is not None:\n                    node = obj.node\n                    if node.parent:\n                        node._nodes.updated()\n\n                self._before_refresh(obj, value)\n                obj.refresh(\n                    layout=self._layout,\n                    children=self._refresh_children,\n                    parent=self._refresh_parent,","sourceCodeStart":841,"sourceCodeEnd":877,"githubUrl":"https://github.com/Textualize/textual/blob/06dbeef4bb70fb718236aa418ed658ef4667a126/src/textual/css/_style_properties.py#L841-L877","documentation":"Thrown by the StringEnumProperty descriptor when a style rule that only accepts a fixed set of string keywords receives a value outside that set (e.g. `dock`, `display`, `overflow`, `text-align`). The message lists the valid keywords and echoes the offending value so the mistake is obvious. It is a subclass of StyleValueError raised during `styles.<rule> = value` assignment or CSS parsing.","triggerScenarios":"Assigning an invalid keyword to a string-enum style property: `styles.dock = \"middle\"` (valid: top/right/bottom/left), `styles.display = \"inline\"`, `styles.overflow = \"visible\"`, or the same values in a stylesheet rule like `dock: center;`.","commonSituations":"Typos in CSS TCSS files, copy-pasting web CSS values (e.g. `display: inline-block`, `overflow: visible`) that don't exist in Textual, or assuming a web-CSS keyword applies. Also happens after upgrading Textual when supported keywords change.","solutions":["Check the message's friendly_list of valid values and use one of those exact keywords","Look up the property in the Textual CSS reference for the full keyword set (e.g. display accepts block, grid, etc.)","For layout intents not covered, restructure with containers/grid instead of an unsupported keyword"],"exampleFix":"# before\nwidget.styles.dock = \"middle\"  # StyleValueError\n# after\nwidget.styles.dock = \"top\"","handlingStrategy":"validation","validationCode":"valid = {\"top\",\"right\",\"bottom\",\"left\"}\nif value in valid:\n    widget.styles.dock = value","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep an allowlist of valid keywords per style rule and validate config-driven values before assignment","Enable TCSS validation in tests by parsing all stylesheets up front"],"tags":["textual","css","style-property","enum-validation"],"backgroundTag":"invalid-css-value","analyzedSha":"06dbeef4bb70fb718236aa418ed658ef4667a126","analyzedAt":"2026-08-27T02:36:57.214Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}