oraios/serena · error · ValueError

Unsupported Luau Roblox security level: {security_level}. Ex

Error message

Unsupported Luau Roblox security level: {security_level}. Expected one of: {', '.join(sorted(SUPPORTED_ROBLOX_SECURITY_LEVELS))}

What it means

luau_lsp validates the 'roblox_security_level' custom setting against SUPPORTED_ROBLOX_SECURITY_LEVELS when resolving support files. The security level is passed to the Roblox API type definitions, so an unknown level would produce an invalid server configuration; hence a ValueError is raised with the list of accepted levels.

Source

Thrown at src/solidlsp/language_servers/luau_lsp.py:252

                    "Please build from source: https://github.com/JohnnyMorganz/luau-lsp"
                )
            if system == "Darwin":
                return "luau-lsp-macos.zip"
            if system == "Windows":
                return "luau-lsp-win64.zip"
            raise RuntimeError(f"Unsupported operating system: {system}")

    @staticmethod
    def _get_platform_type(custom_settings: SolidLSPSettings.CustomLSSettings) -> str:
        platform_type = custom_settings.get("platform", "roblox")
        if platform_type not in SUPPORTED_PLATFORMS:
            raise ValueError(f"Unsupported Luau platform: {platform_type}. Expected one of: {', '.join(sorted(SUPPORTED_PLATFORMS))}")
        return platform_type

    @staticmethod
    def _get_roblox_security_level(custom_settings: SolidLSPSettings.CustomLSSettings) -> str:
        security_level = custom_settings.get("roblox_security_level", "PluginSecurity")
        if security_level not in SUPPORTED_ROBLOX_SECURITY_LEVELS:
            raise ValueError(
                f"Unsupported Luau Roblox security level: {security_level}. "
                f"Expected one of: {', '.join(sorted(SUPPORTED_ROBLOX_SECURITY_LEVELS))}"
            )
        return security_level

    @classmethod
    def _get_workspace_configuration(cls, custom_settings: SolidLSPSettings.CustomLSSettings) -> dict[str, dict[str, str]]:
        return {"platform": {"type": cls._get_platform_type(custom_settings)}}

    def _create_dependency_provider(self) -> LanguageServerDependencyProvider:
        return self.DependencyProvider(self._custom_settings, self._ls_resources_dir)

    def __init__(self, config: LanguageServerConfig, repository_root_path: str, solidlsp_settings: SolidLSPSettings):
        super().__init__(config, repository_root_path, None, "luau", solidlsp_settings)
        self.server_ready = threading.Event()

    def _create_base_initialize_params(self) -> dict:

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Check SUPPORTED_ROBLOX_SECURITY_LEVELS in src/solidlsp/language_servers/luau_lsp.py for exact values
  2. Set roblox_security_level to a valid level (default 'PluginSecurity')
  3. Remove the roblox_security_level key to use the default

Example fix

// before
{"luau_lsp": {"roblox_security_level": "Maximum"}}
// after
{"luau_lsp": {"roblox_security_level": "PluginSecurity"}}
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_ROBLOX_SECURITY_LEVELS = {"PluginSecurity"}  # check luau_lsp.py for exact set
level = settings.get("roblox_security_level", "PluginSecurity")
if level not in SUPPORTED_ROBLOX_SECURITY_LEVELS:
    raise ValueError(f"roblox_security_level must be one of {sorted(SUPPORTED_ROBLOX_SECURITY_LEVELS)}")

Type guard

def is_valid_security_level(v) -> bool:
    return isinstance(v, str) and v in SUPPORTED_ROBLOX_SECURITY_LEVELS

Try / catch

try:
    ls = SolidLSP("luau")
except ValueError as e:
    if "security level" in str(e):
        logger.error("Fix custom_settings['roblox_security_level']: %s", e)
    raise

Prevention

When it happens

Trigger: Setting CustomLSSettings for luau_lsp with roblox_security_level set to a value not in SUPPORTED_ROBLOX_SECURITY_LEVELS (e.g. 'Maximum', 'LocalSecurity', a misspelled 'Pluginsecurity') — the check runs in _get_roblox_security_level called from _resolve_support_files.

Common situations: Guessing security level names instead of using the Roblox API security level enum values; casing mistakes; copying a value from Roblox docs that does not match the exact expected constant.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/3373129868db6620. Report an issue: GitHub.