oraios/serena · error · ValueError

Kotlin LSP version must contain only dot-separated integers:

Error message

Kotlin LSP version must contain only dot-separated integers: {version!r}

What it means

Raised by `_create_artifact` when a user-supplied Kotlin LSP version string does not parse as dot-separated integers (e.g. '1.0-beta'). The version is split on '.' and each part is passed to `int()`; the resulting ValueError is re-raised with a clearer message before any download or hash lookup occurs. This is input validation, so it fails before any network I/O.

Source

Thrown at src/solidlsp/language_servers/kotlin_language_server.py:135

    class DependencyProvider(LanguageServerDependencyProviderSinglePath):
        def __init__(self, custom_settings: SolidLSPSettings.CustomLSSettings, ls_resources_dir: str, project_cache_dir: str):
            super().__init__(custom_settings, ls_resources_dir)
            self._project_cache_dir = project_cache_dir

        @classmethod
        def _create_artifact(cls, version: str, platform_id: PlatformId) -> KotlinLSPArtifact:
            """Build download and launcher metadata for one Kotlin LSP release.

            JetBrains has three publishing layouts: legacy ZIPs before 262.4739.0,
            modern platform archives under ``/kotlin-lsp`` through 262.7569.0,
            and modern archives under ``/language-server/kotlin-server`` from
            262.8190.0 onward. Serena verifies the frozen initial and current default
            releases; arbitrary user-selected versions are unverified by design.
            """
            try:
                version_parts = tuple(int(part) for part in version.split("."))
            except ValueError as exc:
                raise ValueError(f"Kotlin LSP version must contain only dot-separated integers: {version!r}") from exc

            verified = version in {INITIAL_KOTLIN_LSP_VERSION, DEFAULT_KOTLIN_LSP_VERSION}
            if version_parts >= KOTLIN_SERVER_PACKAGING_MIN_VERSION:
                artifact_config = KOTLIN_SERVER_ARTIFACT_BY_PLATFORM.get(platform_id.value)
                if artifact_config is None:
                    raise ValueError(f"Unsupported platform for Kotlin LSP {version}: {platform_id.value}")

                asset_suffix, archive_type, launcher_parts = artifact_config
                asset_name = f"kotlin-server-{version}{asset_suffix}"
                cdn_path = "language-server/kotlin-server" if version_parts >= KOTLIN_SERVER_CDN_PATH_MIN_VERSION else "kotlin-lsp"
                return KotlinLSPArtifact(
                    dependency=DownloadedDependency(
                        url=f"https://download-cdn.jetbrains.com/{cdn_path}/{version}/{asset_name}",
                        archive_type=archive_type,
                        allowed_hosts=KOTLIN_LSP_ALLOWED_HOSTS,
                        verified=verified,
                    ),
                    launcher_parts=tuple(part.format(version=version) for part in launcher_parts),

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Use a valid dot-separated integer version, e.g. '223.8617.171' or a value >= KOTLIN_SERVER_PACKAGING_MIN_VERSION if you want the new packaging layout
  2. Check JetBrains's Kotlin LSP releases page for exact published version numbers
  3. Strip non-numeric suffixes from the version string before passing it
  4. If reading the version from config/env, print/validate it first

Example fix

// before
KotlinLanguageServer(version="1.0.0-alpha")
// after
KotlinLanguageServer(version="241.18034.62")  # exact dot-separated integers only
Defensive patterns

Strategy: validation

Validate before calling

import re
def validate_kotlin_lsp_version(v: str) -> None:
    if not re.fullmatch(r"\d+(\.\d+)*", v):
        raise ValueError(f"Kotlin LSP version must be dot-separated integers: {v!r}")
validate_kotlin_lsp_version(user_version)  # call before constructing the server/config

Type guard

def is_valid_kotlin_lsp_version(v: object) -> bool:
    return isinstance(v, str) and bool(re.fullmatch(r"\d+(\.\d+)*", v))

Try / catch

try:
    artifact_or_server = KotlinLanguageServer(version=user_version)
except ValueError as e:
    if "dot-separated integers" in str(e):
        raise ValueError(f"Bad Kotlin LSP version {user_version!r}: use e.g. '241.18034.62'") from e
    raise

Prevention

When it happens

Trigger: Passing a non-numeric version (e.g. via KotlinLanguageServer dependency config, DEFAULT/INITIAL version override, or dep-hash update tooling) such as '1.0.0-beta', 'nightly', '', or '1..0' into `_create_artifact`; `int(part)` raises ValueError which is re-raised with this message.

Common situations: Copying a JetBrains release name that includes a suffix; typos like '262.819O.0' (letter O); passing an empty or environment-substituted variable; downstream tests (test_invalid_version_is_rejected_before_download) exercise this path deliberately.

Related errors


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