jackwener/OpenCLI · warning · EmptyResultError
Medium tag "${tag}" RSS feed has no items.
Error message
Medium tag "${tag}" RSS feed has no items. What it means
After fetching and parsing the RSS XML, if no <item> elements are found the adapter throws EmptyResultError: the tag resolved but its feed currently contains zero articles. This guards downstream consumers against empty output instead of returning an empty list.
Source
Thrown at clis/medium/tag.js:123
`medium tag request failed: ${err?.message ?? err}`,
'Check that medium.com is reachable from this network.',
);
}
if (resp.status === 404) {
throw new EmptyResultError('medium tag', `Medium tag "${tag}" does not exist.`);
}
if (!resp.ok) {
throw new CommandExecutionError(`medium tag returned HTTP ${resp.status}`);
}
const xml = await resp.text();
const items = [];
const re = /<item[^>]*>([\s\S]*?)<\/item>/g;
let m;
while ((m = re.exec(xml)) !== null) {
items.push(m[1]);
}
if (!items.length) {
throw new EmptyResultError('medium tag', `Medium tag "${tag}" RSS feed has no items.`);
}
return items.slice(0, limit).map((block, i) => ({
rank: i + 1,
title: decodeHtml(extractTag(block, 'title')).trim(),
author: decodeHtml(extractTag(block, 'dc:creator')).trim(),
description: stripHtml(extractTag(block, 'description')),
categories: extractCategories(block).join(', '),
published: isoDateFromRfc822(decodeHtml(extractTag(block, 'pubDate')).trim()),
url: decodeHtml(extractTag(block, 'link')).trim(),
}));
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Retry later — Medium may be serving an empty or altered feed temporarily.
- Inspect the raw feed with curl https://medium.com/feed/tag/<slug> to confirm whether items are truly absent or the response is an anti-bot page.
- Choose a more active related tag for your query.
- If the feed visibly has items but the CLI reports none, report a parser bug (the <item> regex in clis/medium/tag.js) upstream.
Example fix
// before medium tag my-obscure-new-tag # EmptyResultError: feed has no items // after medium tag programming
Defensive patterns
Strategy: fallback
Validate before calling
const res = await fetch(`https://medium.com/feed/tag/${slug}`);
const xml = await res.text();
if (res.ok && !/<item[\s>]/.test(xml)) console.warn(`Feed for "${slug}" currently has no items`); Try / catch
try {
items = await run(['medium', 'tag', slug]);
} catch (e) {
if (e instanceof EmptyResultError && /has no items/.test(e.message)) {
items = []; // treat as legitimately empty, or fall back to a broader tag
} else throw e;
} Prevention
- Treat empty feeds as an expected outcome for niche/new tags.
- Fall back to related, more active tags when a feed is empty.
- Retry later — Medium sometimes serves empty/altered bodies transiently.
- Inspect the raw feed with curl before assuming the parser is broken.
When it happens
Trigger: Calling `medium tag <tag>` on a tag whose RSS feed exists but has no items — brand-new tags, abandoned tags, or feeds temporarily returning empty bodies (sometimes during Medium-side incidents or anti-bot interstitials that return 200 with stripped content).
Common situations: Querying very niche or newly created tags; Medium serving a consent/anti-bot page with 200 OK so the item regex matches nothing; a tag that existed at 404-check time but whose feed body changed format.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- BBC ${raw} feed returned no items.
- No prices returned for train_no=${trainNo} ${fromStation.nam
- No 12306 stations match "${keyword}"
- archive search returned malformed JSON: ${error?.message ||
- CoinGecko returned no category data.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/e89534373f0771a7.
Report an issue: GitHub.