HKUDS/Vibe-Trading · error · ValueError
token_issue_path must differ from path (the WebSocket upgrad
Error message
token_issue_path must differ from path (the WebSocket upgrade path)
What it means
Raised by a model-level validator when token_issue_path normalizes to the same value as path, the WebSocket upgrade endpoint. Both cannot share one route because the server must distinguish an HTTP token-issuing request from a WebSocket upgrade on the same path.
Source
Thrown at agent/src/channels/websocket.py:130
raise ValueError('path must start with "/"')
return _normalize_config_path(value)
@field_validator("token_issue_path")
@classmethod
def token_issue_path_format(cls, value: str) -> str:
value = value.strip()
if not value:
return ""
if not value.startswith("/"):
raise ValueError('token_issue_path must start with "/"')
return _normalize_config_path(value)
@model_validator(mode="after")
def token_issue_path_differs_from_ws_path(self) -> Self:
if not self.token_issue_path:
return self
if _normalize_config_path(self.token_issue_path) == _normalize_config_path(self.path):
raise ValueError("token_issue_path must differ from path (the WebSocket upgrade path)")
return self
@model_validator(mode="after")
def wildcard_host_requires_auth(self) -> Self:
if self.host not in ("0.0.0.0", "::"):
return self
if self.token.strip() or self.token_issue_secret.strip():
return self
raise ValueError(
"host is 0.0.0.0 (all interfaces) but neither token nor "
"token_issue_secret is set — set one to prevent unauthenticated access"
)
def publish_runtime_model_update(
bus: MessageBus,
model: str,
model_preset: str | None,View on GitHub (pinned to 80ffdda44c)
Solutions
- Change token_issue_path to a distinct route, e.g. "/issue-token"
- Keep path: /ws and only set token_issue_path when you actually serve tokens over HTTP
Example fix
# before path = "/ws" token_issue_path = "/ws" # after path = "/ws" token_issue_path = "/issue-token"
Defensive patterns
Strategy: validation
Validate before calling
from agent.src.channels.websocket import _normalize_config_path
if token_issue_path and _normalize_config_path(token_issue_path) == _normalize_config_path(path):
raise SystemExit("token_issue_path must differ from WebSocket path — pick e.g. /issue-token") Type guard
def paths_conflict(ws: str, issue: str) -> bool:
return bool(issue) and _normalize_config_path(issue) == _normalize_config_path(ws) Prevention
- Use obviously distinct route names (/ws vs /issue-token)
- Remember trailing slashes are normalized away — they do not create new routes
When it happens
Trigger: Setting path="/ws" and token_issue_path="/ws", or values that normalize equal such as "/ws/" vs "/ws" (_normalize_config_path strips trailing differences). Only fires when token_issue_path is non-empty.
Common situations: Copy-paste error where both fields were given the same value; setting token_issue_path='/' or to the WS path while experimenting; normalization surprises like adding a trailing slash thinking it makes a different route.
Understand the failure class
Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.
Related errors
- unix_socket_path must not contain NUL bytes
- unix_socket_path must be an absolute path
- path must start with "/"
- token_issue_path must start with "/"
- host is 0.0.0.0 (all interfaces) but neither token nor token
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/2445e319f1db7be9.
Report an issue: GitHub.