calesthio/OpenMontage · error · ValueError
ARK_BASE_URL must be an https:// URL
Error message
ARK_BASE_URL must be an https:// URL
What it means
Raised by SeedanceArk's `_get_base_url()`: the effective Ark base URL — from `ARK_BASE_URL` env var or the class default — must start with `https://`. The check runs after `rstrip('/')` and exists because the Ark API sends the API key in headers; a plain-http base would leak `ARK_API_KEY` in cleartext, and a malformed value (missing scheme, `http://`, a bare host) would produce broken request URLs.
Source
Thrown at tools/video/seedance_ark.py:360
"reference_video_urls",
"reference_audio_urls",
]
side_effects = [
"submits a paid task to the Volcengine Ark API",
"writes the completed video to output_path",
]
user_visible_verification = [
"Watch the downloaded clip for visual continuity and synchronized audio",
"Confirm the local artifact before the 24-hour remote URL expires",
]
def _get_api_key(self) -> str | None:
return os.environ.get("ARK_API_KEY")
def _get_base_url(self) -> str:
base_url = os.environ.get("ARK_BASE_URL", self.BASE_URL).rstrip("/")
if not base_url.startswith("https://"):
raise ValueError("ARK_BASE_URL must be an https:// URL")
return base_url
def get_status(self) -> ToolStatus:
api_key = self._get_api_key()
if not api_key or api_key.lower().startswith("bearer "):
return ToolStatus.UNAVAILABLE
return ToolStatus.AVAILABLE
def estimate_token_usage(self, inputs: dict[str, Any]) -> int:
"""Estimate billable completion tokens using Ark's published formula."""
_, variant = self._resolve_model(inputs)
max_duration = 30 if variant == "2.5" else 15
duration = self._normalize_duration(inputs.get("duration", 5), max_duration)
output_seconds = max_duration if duration == -1 else duration
video_refs = list(inputs.get("reference_video_urls") or [])
if inputs.get("reference_video_url"):
video_refs.append(inputs["reference_video_url"])
video_durations = list(inputs.get("reference_video_durations") or [])View on GitHub (pinned to 95e1c3d0ab)
Solutions
- Set `ARK_BASE_URL` to the full https URL, e.g. `https://ark.cn-beijing.volces.com/api/v3`
- If you must use a local HTTP dev gateway, terminate TLS locally (e.g. via an https reverse proxy) rather than downgrading the scheme
- Remove the variable entirely to fall back to the class default `BASE_URL`, which is https
Example fix
# before export ARK_BASE_URL="ark.cn-beijing.volces.com/api/v3" # after export ARK_BASE_URL="https://ark.cn-beijing.volces.com/api/v3"
Defensive patterns
Strategy: validation
Validate before calling
import os
base = os.environ.get("ARK_BASE_URL", "").rstrip("/")
if base and not base.startswith("https://"):
raise ValueError("ARK_BASE_URL must start with https:// — refusing to send ARK_API_KEY over plaintext") Type guard
def is_https_base_url(url: str) -> bool:
return isinstance(url, str) and url.startswith("https://") Try / catch
try:
base_url = tool._get_base_url()
except ValueError as e:
raise SystemExit(f"config error: {e}; fix ARK_BASE_URL") from e Prevention
- Validate ARK_BASE_URL at process start, not at first request
- Never 'fix' this by allowing http:// — the check protects ARK_API_KEY from cleartext exposure
When it happens
Trigger: Setting `ARK_BASE_URL=http://ark.cn-beijing.volces.com` (http scheme); a value with a typo like `ark.cn-beijing.volces.com` (no scheme); a proxy URL with `socks://` or another scheme; trailing content that breaks the prefix check.
Common situations: Using an internal HTTP proxy during development; copying a base URL from docs that omits the scheme; pointing at a self-hosted gateway; CI environments injecting a different base URL variable.
Related errors
- ARK_CNY_PER_USD must be a finite number greater than 0
- ARK_API_KEY must contain only the API Key body; remove the '
- model must be a non-empty Ark Model/Endpoint ID
- Invalid status: {status!r}
- Required environment variable {key!r} is not set
AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15).
Data as JSON: /api/errors/bb3924b552df97a5.
Report an issue: GitHub.