FujiwaraChoki/MoneyPrinterV2 · error · ValueError
Unsupported provider '{provider}'. Expected 'twitter' or 'yo
Error message
Unsupported provider '{provider}'. Expected 'twitter' or 'youtube'. What it means
Raised by get_provider_cache_path when the provider string is neither 'twitter' nor 'youtube'. The cache layer only knows how to resolve paths for these two providers, so any other value is rejected before touching the filesystem.
Source
Thrown at src/cache.py:61
def get_provider_cache_path(provider: str) -> str:
"""
Gets the cache path for a supported account provider.
Args:
provider (str): The provider name ("twitter" or "youtube")
Returns:
path (str): The provider-specific cache path
Raises:
ValueError: If the provider is unsupported
"""
if provider == "twitter":
return get_twitter_cache_path()
if provider == "youtube":
return get_youtube_cache_path()
raise ValueError(f"Unsupported provider '{provider}'. Expected 'twitter' or 'youtube'.")
def get_accounts(provider: str) -> List[dict]:
"""
Gets the accounts from the cache.
Args:
provider (str): The provider to get the accounts for
Returns:
account (List[dict]): The accounts
"""
cache_path = get_provider_cache_path(provider)
if not os.path.exists(cache_path):
# Create the cache file
with open(cache_path, 'w') as file:
json.dump({
"accounts": []View on GitHub (pinned to 5192af8eca)
Solutions
- Normalize/lowercase the provider string before calling cache functions
- Fix the caller to pass exactly 'twitter' or 'youtube'
- If a new provider is intended, extend get_provider_cache_path with a matching path resolver
Example fix
// before
accounts = get_accounts("Twitter")
// after
provider = provider.strip().lower()
if provider not in ("twitter", "youtube"):
raise ValueError(f"Unknown provider: {provider}")
accounts = get_accounts(provider) Defensive patterns
Strategy: validation
Validate before calling
provider = provider.strip().lower()
if provider not in ("twitter", "youtube"):
raise ValueError(f"Unsupported provider '{provider}'. Expected 'twitter' or 'youtube'.") Type guard
def is_supported_provider(provider: str) -> bool:
return isinstance(provider, str) and provider.strip().lower() in ("twitter", "youtube") Prevention
- Normalize provider strings to lowercase at the system boundary (CLI/config parsing)
- Keep a single SUPPORTED_PROVIDERS tuple imported by all call sites instead of repeating literals
- Reject unknown providers at config load time, not deep in cache code
When it happens
Trigger: Calling get_accounts/add_account/remove_account with a provider value like 'instagram', 'Twitter' (capitalized), 'yt', or an empty string; passing user input through without normalizing it.
Common situations: Typos or case mismatches ('Twitter' vs 'twitter'), passing a provider read from config.json without validation, or new providers added to the app but not to src/cache.py.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Affiliate link is invalid. Expected a full URL, got: {self.a
- Firefox profile path does not exist or is not a directory: {
- Could not locate extracted google-maps-scraper directory.
- Expected built scraper binary at: {built_binary}
- Post Bridge returned an invalid social accounts payload.
AI-assisted analysis of FujiwaraChoki/MoneyPrinterV2@5192af8eca (2026-08-28).
Data as JSON: /api/errors/d8c00974d440685c.
Report an issue: GitHub.