{"record":{"id":"c77f1b1d21bf7b3d","repo":"nautechsystems/nautilus_trader","slug":"theme-name-not-found-suggestion-text-availab","errorCode":null,"errorMessage":"Theme '{name}' not found.{suggestion_text} Available themes: {available}. Register custom themes with register_theme().","messagePattern":"Theme '(.+?)' not found\\.(.+?) Available themes: (.+?)\\. Register custom themes with register_theme\\(\\)\\.","errorType":"exception","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"python/nautilus_trader/analysis/themes.py","lineNumber":122,"sourceCode":"    -------\n    dict[str, Any]\n        Theme configuration dictionary with \"template\" and \"colors\" keys.\n\n    Raises\n    ------\n    KeyError\n        If the theme name is not registered.\n\n    \"\"\"\n    _require_not_none(name, \"name\")\n\n    if name not in _THEMES:\n        available = \", \".join(_THEMES.keys())\n\n        suggestions = get_close_matches(name, _THEMES.keys(), n=3, cutoff=0.6)\n        suggestion_text = f\" Did you mean: {', '.join(suggestions)}?\" if suggestions else \"\"\n\n        raise KeyError(\n            f\"Theme '{name}' not found.{suggestion_text} \"\n            f\"Available themes: {available}. \"\n            f\"Register custom themes with register_theme().\",\n        )\n\n    theme = _THEMES[name].copy()\n    theme[\"colors\"] = theme[\"colors\"].copy()\n    return theme\n\n\ndef register_theme(name: str, template: str, colors: dict[str, str]) -> None:\n    \"\"\"\n    Register a custom theme.\n\n    Parameters\n    ----------\n    name : str\n        The theme name for future reference.","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/python/nautilus_trader/analysis/themes.py#L104-L140","documentation":"get_theme looks up the _THEMES registry of built-in and custom theme configurations. An unknown name raises a KeyError listing available themes plus up to 3 fuzzy 'Did you mean' suggestions (difflib.get_close_matches, cutoff 0.6).","triggerScenarios":"Calling get_theme(\"DARK\") when the builtin is \"dark\"; passing a theme name from config that was never registered via register_theme; a renamed builtin theme.","commonSituations":"Case sensitivity mistakes; YAML/JSON config with a stale theme name; copying theme names between projects with different custom themes.","solutions":["Use one of the names printed in 'Available themes:'","Adopt the 'Did you mean' suggestion (e.g. fix case: 'dark' not 'DARK')","Register the custom theme first with register_theme()"],"exampleFix":"// before\ntheme = get_theme(\"Dark\")  # KeyError, did you mean 'dark'?\n// after\ntheme = get_theme(\"dark\")","handlingStrategy":"try-catch","validationCode":"from nautilus_trader.analysis.themes import _THEMES\nif name not in _THEMES:\n    name = \"dark\"","typeGuard":"def theme_exists(name: str) -> bool:\n    from nautilus_trader.analysis.themes import _THEMES\n    return isinstance(name, str) and name in _THEMES","tryCatchPattern":"try:\n    theme = get_theme(name)\nexcept KeyError:\n    logger.warning(f\"Theme '{name}' not found, using 'dark'\")\n    theme = get_theme(\"dark\")","preventionTips":["Use lowercase theme-name constants; registry names are case-sensitive","Register custom themes at application startup before any rendering","Keep theme names in a central constants module","Validate config theme names against the registry at startup"],"tags":["python","registry","keyerror","theme"],"backgroundTag":"resource-not-found","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}