{"record":{"id":"75f2a25d46db38fe","repo":"Textualize/textual","slug":"tree-sitter-is-available-but-no-built-in-or-user","errorCode":null,"errorMessage":"tree-sitter is available, but no built-in or user-registered language called {language!r}.\nEnsure the language is installed (e.g. `pip install tree-sitter-ruby`)\nFalling back to plain text.","messagePattern":"tree-sitter is available, but no built-in or user-registered language called (.+?)\\.\nEnsure the language is installed \\(e\\.g\\. `pip install tree-sitter-ruby`\\)\nFalling back to plain text\\.","errorType":"exception","errorClass":"LanguageDoesNotExist","httpStatus":null,"severity":"warning","filePath":"src/textual/widgets/_text_area.py","lineNumber":1147,"sourceCode":"                language available in the current environment (e.g. use `python` for `tree-sitter-python`).\n                If None, the document will be treated as plain text.\n        \"\"\"\n        self._highlight_query = None\n        if TREE_SITTER and language:\n            if language in self._languages:\n                # User-registered languages take priority.\n                highlight_query = self._languages[language].highlight_query\n                document_language = self._languages[language].language\n                if document_language is None:\n                    document_language = get_language(language)\n            else:\n                # No user-registered language, so attempt to use a built-in language.\n                highlight_query = self._get_builtin_highlight_query(language)\n                document_language = get_language(language)\n\n            # No built-in language, and no user-registered language: use plain text and warn.\n            if document_language is None:\n                raise LanguageDoesNotExist(\n                    f\"tree-sitter is available, but no built-in or user-registered language called {language!r}.\\n\"\n                    f\"Ensure the language is installed (e.g. `pip install tree-sitter-ruby`)\\n\"\n                    f\"Falling back to plain text.\"\n                )\n            else:\n                document: DocumentBase\n                try:\n                    document = SyntaxAwareDocument(text, document_language)\n                except SyntaxAwareDocumentError:\n                    document = Document(text)\n                    log.warning(\n                        f\"Parser not found for language {document_language!r}. Parsing disabled.\"\n                    )\n                else:\n                    self._highlight_query = document.prepare_query(highlight_query)\n        elif language and not TREE_SITTER:\n            # User has supplied a language i.e. `TextArea(language=\"python\")`, but they\n            # don't have tree-sitter available in the environment. We fallback to plain text.","sourceCodeStart":1129,"sourceCodeEnd":1165,"githubUrl":"https://github.com/Textualize/textual/blob/06dbeef4bb70fb718236aa418ed658ef4667a126/src/textual/widgets/_text_area.py#L1129-L1165","documentation":"Raised by TextArea._set_document when tree-sitter is installed, but the requested language name is neither user-registered (via TextArea.register_language / a syntax) nor available via tree_sitter.get_language. The message notes it falls back to plain text and suggests installing the language, e.g. pip install tree-sitter-ruby.","triggerScenarios":"TextArea.code_editor('ruby', language='ruby') without `pip install tree-sitter-ruby`; using a language name that doesn't match tree-sitter conventions (e.g. 'golang' vs 'go', 'js' vs 'javascript').","commonSituations":"Missing tree-sitter language packages in the environment, Docker/CI images without the language wheels, name mismatches with tree-sitter package naming, or Textual version changes to bundled languages.","solutions":["Install the matching tree-sitter language package: e.g. `pip install tree-sitter-ruby`.","Use the exact language name Textual/tree-sitter expects (e.g. 'python', 'javascript', 'go' — not 'golang').","Register a custom language/query pair with TextArea.register_language if using a non-bundled grammar.","Note the widget still works as plain text after the error; fix packaging to get highlighting."],"exampleFix":"# before (env lacks the package)\nTextArea.code_editor(code, language='go')\n# after\n# pip install tree-sitter-go\nTextArea.code_editor(code, language='go')","handlingStrategy":"fallback","validationCode":"from textual.widgets.text_area import TextArea\nname = {'golang': 'go'}.get(lang, lang)\nif TextArea is using tree-sitter and not registered/installed: fallback to plain 'text'","typeGuard":null,"tryCatchPattern":"try:\n    TextArea.code_editor(text, language=lang)\nexcept LanguageDoesNotExist:\n    TextArea.code_editor(text)  # plain text","preventionTips":["pip install the tree-sitter-<language> package in the target env","Use canonical language names ('go', 'javascript')","Register custom grammars via TextArea.register_language"],"tags":["textarea","tree-sitter","language","missing-dependency","textual"],"backgroundTag":"missing-optional-dependency","analyzedSha":"06dbeef4bb70fb718236aa418ed658ef4667a126","analyzedAt":"2026-08-27T02:36:57.214Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}