{"record":{"id":"7e216bc123372225","repo":"mastra-ai/mastra","slug":"language-language-is-not-supported-please-choo","errorCode":null,"errorMessage":"Language ${language} is not supported! Please choose from ${Object.values(Language)}","messagePattern":"Language (.+?) is not supported! Please choose from (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/rag/src/document/transformers/character.ts","lineNumber":641,"sourceCode":"        ];\n      case Language.PROTO:\n        return [\n          '\\nsyntax ',\n          '\\npackage ',\n          '\\nimport ',\n          '\\nmessage ',\n          '\\nservice ',\n          '\\nenum ',\n          '\\nrpc ',\n          '\\n\\n',\n          '\\n',\n          ' ',\n          '',\n        ];\n      case Language.RST:\n        return ['\\n=+\\n', '\\n-+\\n', '\\n\\\\*+\\n', '\\n\\\\.\\\\. ', '\\n\\n', '\\n', ' ', ''];\n      default:\n        throw new Error(`Language ${language} is not supported! Please choose from ${Object.values(Language)}`);\n    }\n  }\n}\n","sourceCodeStart":623,"sourceCodeEnd":645,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/rag/src/document/transformers/character.ts#L623-L645","documentation":"CharacterTextSplitter.getSeparatorsForLanguage maps a Language enum value to markdown-aware separator strings. If the language isn't in the switch's cases, the default branch throws listing all supported languages.","triggerScenarios":"splitText/splitMarkdown with a Language value that has no separator table (e.g. a Language added to the enum but not handled in getSeparatorsForLanguage), or a cast string like 'xyz' as Language passed to the constructor.","commonSituations":"Passing a raw string from config as Language without validation, upgrading @mastra/rag and using a newly added Language while on a stale splitter path, or typo'd language names.","solutions":["Use a supported Language enum member (e.g. Language.MARKDOWN, Language.RST) instead of a raw/typo'd string.","Check the list in the thrown message (Object.values(Language)) and pick from it.","If you need a language that isn't supported yet, pass plain separators/defaults or fall back to CharacterTextSplitter without markdown-awareness."],"exampleFix":"// before\nnew CharacterTextSplitter({ separator: '\n', language: 'md' as Language });\n// after\nimport { Language } from '@mastra/rag';\nnew CharacterTextSplitter({ separator: '\n', language: Language.MARKDOWN });","handlingStrategy":"validation","validationCode":"import { Language } from '@mastra/rag';\nconst lang: Language | undefined = Object.values(Language).find(v => v === config.language);\nif (!lang) throw new Error(`Unsupported language: ${config.language}`);","typeGuard":"const isSupportedLanguage = (v: unknown): v is Language =>\n  typeof v === 'string' && (Object.values(Language) as string[]).includes(v);","tryCatchPattern":"try {\n  return splitter.splitText(text);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('is not supported')) {\n    return fallbackSplitter.splitText(text);\n  }\n  throw e;\n}","preventionTips":["Always use Language enum members, never raw strings.","Validate config language values against Object.values(Language) at startup.","After upgrading @mastra/rag, re-check that your chosen language still has a separator table."],"tags":["configuration","unsupported-language","rag"],"backgroundTag":"unsupported-language","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}