ZhuLinsen/daily_stock_analysis · error · IntelligenceServiceError
scope_value is required when scope_type={scope_type}
Error message
scope_value is required when scope_type={scope_type} What it means
Error "scope_value is required when scope_type={scope_type}" thrown in ZhuLinsen/daily_stock_analysis.
Source
Thrown at src/services/intelligence_service.py:378
def _normalize_source_fields(self, payload: Dict[str, Any]) -> Dict[str, Any]:
name = str(payload.get("name") or "").strip()
url = str(payload.get("url") or "").strip()
source_type = str(payload.get("source_type") or "rss").strip().lower()
scope_type = str(payload.get("scope_type") or "market").strip().lower()
scope_value = str(payload.get("scope_value") or "").strip() or None
market = str(payload.get("market") or "cn").strip().lower()
enabled = bool(payload.get("enabled", True))
description = str(payload.get("description") or "").strip() or None
if not name:
raise IntelligenceServiceError("source name is required")
if not url:
raise IntelligenceServiceError("source url is required")
if source_type not in _ALLOWED_SOURCE_TYPES:
raise IntelligenceServiceError(f"unsupported source_type: {source_type}")
if scope_type not in _ALLOWED_SCOPE_TYPES:
raise IntelligenceServiceError(f"unsupported scope_type: {scope_type}")
if scope_type in {"symbol", "sector"} and not scope_value:
raise IntelligenceServiceError(f"scope_value is required when scope_type={scope_type}")
if market not in _ALLOWED_MARKETS:
raise IntelligenceServiceError(f"unsupported market: {market}")
return {
"name": name[:100],
"source_type": source_type,
"url": url,
"enabled": enabled,
"scope_type": scope_type,
"scope_value": scope_value[:64] if scope_value else None,
"market": market,
"description": description,
}
def _validate_url(self, raw_url: str, *, allow_no_url: bool = False) -> None:
if allow_no_url and raw_url.startswith("no-url:intel:"):
return
parsed = urlparse(raw_url)
if parsed.scheme.lower() not in {"http", "https"} or not parsed.netloc:View on GitHub (pinned to 5159bd72e8)
Solutions
- Provide scope_value for the chosen scope_type (e.g. a stock code or keyword).
- If no scope is intended, use a scope_type that does not require a value.
- Check the API request body to ensure scope_value is not empty or omitted.
When it happens
Trigger: Thrown at src/services/intelligence_service.py:378 when the library encounters an invalid state.
Common situations: Raised when scope_value is missing for a scope_type that requires it; occurs when creating an intelligence source scoped to a market/stock without supplying the scope value.
AI-assisted analysis of ZhuLinsen/daily_stock_analysis@5159bd72e8 (2026-08-15).
Data as JSON: /api/errors/618372349b4aec01.
Report an issue: GitHub.