{"record":{"id":"80097c15677baa41","repo":"jackwener/OpenCLI","slug":"coingecko-has-no-coin-with-id-id","errorCode":null,"errorMessage":"coingecko has no coin with id \"${id}\".","messagePattern":"coingecko has no coin with id \"(.+?)\"\\.","errorType":"http","errorClass":"EmptyResultError","httpStatus":404,"severity":"error","filePath":"clis/coingecko/coin.js","lineNumber":54,"sourceCode":"            throw new ArgumentError(`coingecko currency must look like a currency slug (got \"${args.currency}\")`);\n        }\n\n        const url = new URL(`https://api.coingecko.com/api/v3/coins/${id}`);\n        url.searchParams.set('localization', 'false');\n        url.searchParams.set('tickers', 'false');\n        url.searchParams.set('market_data', 'true');\n        url.searchParams.set('community_data', 'false');\n        url.searchParams.set('developer_data', 'false');\n        url.searchParams.set('sparkline', 'false');\n\n        let resp;\n        try {\n            resp = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0' } });\n        } catch (error) {\n            throw new CommandExecutionError(`coingecko coin request failed: ${error?.message || error}`);\n        }\n        if (resp.status === 404) {\n            throw new EmptyResultError('coingecko coin', `coingecko has no coin with id \"${id}\".`);\n        }\n        if (resp.status === 429) {\n            throw new CommandExecutionError('coingecko returned HTTP 429 (rate limited)', 'Free tier allows ~30 calls/min. Wait and retry.');\n        }\n        if (!resp.ok) {\n            throw new CommandExecutionError(`coingecko coin failed: HTTP ${resp.status}`);\n        }\n        let data;\n        try {\n            data = await resp.json();\n        } catch (error) {\n            throw new CommandExecutionError(`coingecko returned malformed JSON: ${error?.message || error}`);\n        }\n        if (data?.error) {\n            throw new CommandExecutionError(`coingecko returned error: ${data.error}`);\n        }\n\n        const md = data.market_data || {};","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coingecko/coin.js#L36-L72","documentation":"This EmptyResultError is thrown when the CoinGecko API responds with HTTP 404, meaning no coin exists for the given id. The command treats this as 'empty result' rather than a hard failure, since a wrong-but-well-formed slug simply doesn't match any listed coin. The message names the entity and echoes the id queried.","triggerScenarios":"Calling `opencli coingecko coin <id>` where <id> passes slug validation but doesn't exist on CoinGecko — misspelled slugs ('bitcon'), delisted coins, ids for coins only on other aggregators, or test/garbage slugs.","commonSituations":"Typo in the coin id; using a coin's name with wrong spelling; querying a newly listed or delisted token whose id differs from expected; hardcoding ids from a different data source (CMC ids differ from CoinGecko ids).","solutions":["Verify the exact id on coingecko.com (the coin's URL path is its id, e.g. /en/coins/avalanche-2)","Use CoinGecko's /search endpoint (`https://api.coingecko.com/api/v3/search?query=<name>`) to find the correct id","Handle EmptyResultError in your script and fall back to a search or a corrected id list"],"exampleFix":"// before\nopencli coingecko coin bitcon\n// after\nopencli coingecko coin bitcoin","handlingStrategy":"try-catch","validationCode":"const KNOWN = new Set(['bitcoin','ethereum','solana','avalanche-2']);\nif (!KNOWN.has(id)) console.warn(`Unverified coin id: ${id} — may 404`);","typeGuard":"const isKnownCoinId = (v) => typeof v === 'string' && /^[a-z0-9][a-z0-9-]*$/.test(v) && knownIdsFromSearchApi.has(v);","tryCatchPattern":"try { const rows = await run(['coingecko', 'coin', id]); } catch (e) { if (e instanceof EmptyResultError || /has no coin with id/.test(e.message)) { return lookupIdViaSearch(name); } throw e; }","preventionTips":["Resolve coin names to ids via /api/v3/search before querying","Never assume symbols map 1:1 to CoinGecko ids (BTC -> bitcoin, but BNB -> binancecoin)","Keep a curated map of the ids you use and validate against it"],"tags":["http-404","api-request","empty-result"],"backgroundTag":"http-404-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}