CloakHQ/CloakBrowser · error · ValueError
Invalid browser version pin. Use a full numeric Chromium ver
Error message
Invalid browser version pin. Use a full numeric Chromium version, e.g. '148.0.7778.215.2'.
What it means
normalize_requested_version validates the browser version pin (CLOAKBROWSER_BROWSER_VERSION env var or browser_version argument) against a full numeric Chromium version regex. Anything not matching (e.g. '148', 'latest', 'v148.0...') raises ValueError.
Source
Thrown at cloakbrowser/config.py:131
)
return "preview" if raw.strip().lower() == "preview" else "stable"
def normalize_requested_version(version: str | None = None) -> str | None:
"""Return an explicit Chromium version pin from arg/env, or None.
The explicit argument wins over CLOAKBROWSER_VERSION. Only numeric dotted
versions are accepted because the value is interpolated into cache paths and
download URLs.
"""
raw = version if version is not None else os.environ.get("CLOAKBROWSER_VERSION")
if raw is None:
return None
normalized = raw.strip()
if not normalized:
return None
if not _VERSION_PIN_RE.fullmatch(normalized):
raise ValueError(
"Invalid browser version pin. Use a full numeric Chromium version, "
"e.g. '148.0.7778.215.2'."
)
return normalized
def get_chromium_version() -> str:
"""Return the Chromium version for the current platform."""
tag = get_platform_tag()
return PLATFORM_CHROMIUM_VERSIONS.get(tag, CHROMIUM_VERSION)
def get_platform_tag() -> str:
"""Return the platform tag for binary download (e.g. 'linux-x64', 'darwin-arm64')."""
system = platform.system()
machine = platform.machine()
tag = SUPPORTED_PLATFORMS.get((system, machine))
if tag is None:View on GitHub (pinned to d6bad5de26)
Solutions
- Use a full 4-part numeric version like '148.0.7778.215.2'
- Remove the 'v' prefix and any channel suffix
- Unset the env var / omit the argument to use the default version
Example fix
# before ensure_binary(browser_version="148") # after ensure_binary(browser_version="148.0.7778.215.2")
Defensive patterns
Strategy: validation
Validate before calling
import re
VERSION_RE = re.compile(r"^\d+\.\d+\.\d+\.\d+$")
def valid_pin(v: str) -> bool:
return bool(VERSION_RE.fullmatch(v.strip())) Type guard
def is_full_version(v: str | None) -> bool:
return v is not None and bool(__import__('re').fullmatch(r"\d+\.\d+\.\d+\.\d+", v.strip())) Try / catch
try:
ensure_binary(browser_version=v)
except ValueError:
ensure_binary(browser_version="148.0.7778.215.2") Prevention
- Normalize user-supplied versions through a 4-part regex before use
- Prefer omitting browser_version unless you truly need a pin
When it happens
Trigger: Passing browser_version='148' or setting CLOAKBROWSER_BROWSER_VERSION to a partial, prefixed, or non-numeric string; any call path that resolves a binary (ensure_binary, binary_info, launch, etc.).
Common situations: Copying a Chrome version string with a 'v' prefix; assuming short versions work; trailing whitespace is stripped but empty strings and tags like 'beta' are rejected.
Related errors
- Pinned download completed but binary not found at expected p
- Isolated-world DOM evaluation failed for "<scroll-state>"
- CloakBrowser Pro: license could not be validated (server unr
AI-assisted analysis of CloakHQ/CloakBrowser@d6bad5de26 (2026-08-28).
Data as JSON: /api/errors/2123a5f0f7e2e7b9.
Report an issue: GitHub.