HKUDS/Vibe-Trading · error · ValueError

Unsupported platform: {query.platform}

Error message

Unsupported platform: {query.platform}

What it means

The social-media-intelligence skill dispatches data collection through a collectors dict keyed by Platform members (TELEGRAM, DISCORD, REDDIT). If query.platform has no registered collector — unknown enum value, None, or a platform added to the enum but without an implementation — it raises ValueError('Unsupported platform: <platform>').

Source

Thrown at agent/src/skills/social-media-intelligence/SKILL.md:1240

    Args:
        query: Query parameters including platform, keyword, time window, and limit

    Returns:
        Standardized JSON data containing platform / items / metadata

    Raises:
        ValueError: Unsupported platform or invalid parameters
        RuntimeError: API call failed, with retry guidance attached
    """
    collectors = {
        Platform.TWITTER: _collect_twitter,
        Platform.TELEGRAM: _collect_telegram,
        Platform.DISCORD: _collect_discord,
        Platform.REDDIT: _collect_reddit,
    }
    collector = collectors.get(query.platform)
    if not collector:
        raise ValueError(f"Unsupported platform: {query.platform}")

    raw_data = collector(query)

    if query.include_sentiment:
        raw_data = _enrich_with_sentiment(raw_data)

    return raw_data
```

### 6.2 Environment Variables

```bash
# Add the following to .env
TWITTER_BEARER_TOKEN=xxx
TELEGRAM_API_ID=xxx
TELEGRAM_API_HASH=xxx
DISCORD_BOT_TOKEN=xxx
REDDIT_CLIENT_ID=xxx

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Set query.platform to one of the implemented platforms: Platform.TELEGRAM, Platform.DISCORD, or Platform.REDDIT
  2. If a new platform is required, add a _collect_<platform> function and register it in the collectors mapping
  3. Restrict the client-side platform picker to implemented values

Example fix

# before
query = SocialQuery(platform=Platform.TWITTER, ...)

# after
query = SocialQuery(platform=Platform.REDDIT, ...)  # one of TELEGRAM/DISCORD/REDDIT
Defensive patterns

Strategy: type-guard

Validate before calling

SUPPORTED_PLATFORMS = {Platform.TELEGRAM, Platform.DISCORD, Platform.REDDIT}

if query.platform not in SUPPORTED_PLATFORMS:
    raise ValueError(f"platform must be one of {sorted(p.value for p in SUPPORTED_PLATFORMS)}")

Type guard

from enum import Enum

def is_supported_platform(p) -> bool:
    return p in {Platform.TELEGRAM, Platform.DISCORD, Platform.REDDIT}

Try / catch

try:
    raw = collect(query)
except ValueError as e:
    if str(e).startswith("Unsupported platform"):
        return skip_collection(query.platform)
    raise

Prevention

When it happens

Trigger: Calling the collect entrypoint with query.platform set to a Platform member lacking a collector entry, e.g. Platform.TWITTER when only TELEGRAM/DISCORD/REDDIT are mapped, or constructing the query with a raw string that coerces to an unexpected enum value.

Common situations: New Platform enum members added before their collectors ship, user-facing platform pickers exposing more options than the backend implements, persisted queries referencing deprecated platforms, or defaulting platform to None.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/9a72673841b2789d. Report an issue: GitHub.