koala73/worldmonitor · error

No CoinPaprika ID mapping for stablecoins

Error message

No CoinPaprika ID mapping for stablecoins

What it means

Thrown by fetchFromCoinPaprika when COINPAPRIKA_IDS is empty, meaning the CoinGecko->CoinPaprika ID mapping table has no entries, so the fallback source cannot request any tickers. This is a static configuration/invariant check that fires before any network call.

Solutions

  1. Restore/populate COINPAPRIKA_ID_MAP with CoinGecko-id -> CoinPaprika-id pairs for the tracked stablecoins.
  2. Check any env/config conditions that gate the map's definition and ensure they are satisfied in the seed environment.
  3. Add a startup assertion (or this very check) so an empty map fails fast with a clear message.
  4. Grep git history for the map constant if it was accidentally deleted in a refactor.

Example fix

// before
if (COINPAPRIKA_IDS.length === 0) throw new Error('No CoinPaprika ID mapping for stablecoins');
// after
if (COINPAPRIKA_IDS.length === 0) {
  throw new Error('No CoinPaprika ID mapping for stablecoins — populate COINPAPRIKA_ID_MAP in seed-stablecoin-markets.mjs');
}
Defensive patterns

Strategy: validation

Validate before calling

if (!COINPAPRIKA_ID_MAP || Object.keys(COINPAPRIKA_ID_MAP).length === 0) throw new Error('COINPAPRIKA_ID_MAP is empty; populate before seeding');

Type guard

function hasIdMapping(map) { return !!map && typeof map === 'object' && Object.keys(map).length > 0; }

Try / catch

try { await fetchFromCoinPaprika(); } catch (e) { if (e.message === 'No CoinPaprika ID mapping for stablecoins') { console.error('Restore COINPAPRIKA_ID_MAP in seed-stablecoin-markets.mjs'); } throw e; }

Prevention

When it happens

Trigger: COINPAPRIKA_ID_MAP (and derived COINPAPRIKA_IDS) is empty — typically because the map constant was removed, emptied, or conditionally defined based on config/env that is unset.

Common situations: A refactor dropped the ID map; an env/config gate defines the map only for certain environments; editing the stablecoin list emptied the mapped entries.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


AI-assisted analysis of koala73/worldmonitor@e586b8b4b8 (2026-09-22). Data as JSON: /api/errors/6647d494c59dccc1. Report an issue: GitHub.

Appendix: source

Thrown at scripts/seed-stablecoin-markets.mjs:53

async function fetchFromCoinGecko() {
  const { baseUrl, headers } = coingeckoEndpoint();
  const url = `${baseUrl}/coins/markets?vs_currency=usd&ids=${STABLECOIN_IDS}&order=market_cap_desc&sparkline=false&price_change_percentage=7d`;

  const resp = await fetchCoinGeckoWithRetryBudget(url, {
    headers,
    requestTimeoutMs: REQUEST_TIMEOUT_MS,
    budgetMs: COINGECKO_RETRY_BUDGET_MS,
  });
  const data = await resp.json();
  if (!Array.isArray(data) || data.length === 0) {
    throw new Error('CoinGecko returned no stablecoin data');
  }
  return data;
}

async function fetchFromCoinPaprika() {
  console.log('  [CoinPaprika] Falling back to CoinPaprika...');
  if (COINPAPRIKA_IDS.length === 0) throw new Error('No CoinPaprika ID mapping for stablecoins');

  const tickers = await fetchCoinPaprikaTickersById(COINPAPRIKA_IDS, {
    concurrency: COINPAPRIKA_CONCURRENCY,
    timeoutMs: REQUEST_TIMEOUT_MS,
  });
  const reverseMap = new Map(Object.entries(COINPAPRIKA_ID_MAP).map(([g, p]) => [p, g]));
  return tickers
    .map((t) => ({
      id: reverseMap.get(t.id) || t.id,
      current_price: t.quotes.USD.price,
      price_change_percentage_24h: t.quotes.USD.percent_change_24h,
      price_change_percentage_7d_in_currency: t.quotes.USD.percent_change_7d,
      market_cap: t.quotes.USD.market_cap,
      total_volume: t.quotes.USD.volume_24h,
      symbol: t.symbol.toLowerCase(),
      name: t.name,
      image: '',
    }));

View on GitHub (pinned to e586b8b4b8)