jackwener/OpenCLI · warning · CliError
NO_DATA
NO_DATA
Error message
eastmoney returned no announcement data
What it means
The announcement request succeeded (HTTP 2xx) but Eastmoney returned a payload whose data.list is missing or empty, so there are no announcements to return. The library treats an empty result set as a distinct NO_DATA error rather than returning [].
Source
Thrown at clis/eastmoney/announcement.js:38
],
columns: ['time', 'code', 'name', 'title', 'category', 'url'],
func: async (args) => {
const market = String(args.market ?? 'SHA,SZA,BJA').trim() || 'SHA,SZA,BJA';
const limit = Math.max(1, Math.min(Number(args.limit) || 20, 100));
const url = new URL('https://np-anotice-stock.eastmoney.com/api/security/ann');
url.searchParams.set('page_size', String(limit));
url.searchParams.set('page_index', '1');
url.searchParams.set('ann_type', market);
url.searchParams.set('client_source', 'web');
url.searchParams.set('f_node', '0');
url.searchParams.set('s_node', '0');
const resp = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0' } });
if (!resp.ok) throw new CliError('HTTP_ERROR', `announcement failed: HTTP ${resp.status}`);
const data = await resp.json();
const list = Array.isArray(data?.data?.list) ? data.data.list : [];
if (list.length === 0) throw new CliError('NO_DATA', 'eastmoney returned no announcement data');
return list.slice(0, limit).map((it) => {
const primary = Array.isArray(it.codes) && it.codes.length > 0 ? it.codes[0] : {};
const cat = Array.isArray(it.columns) && it.columns.length > 0 ? it.columns[0]?.column_name : '';
return {
time: String(it.notice_date || it.display_time || '').slice(0, 19),
code: primary.stock_code || '',
name: primary.short_name || '',
title: it.title || it.title_ch || '',
category: cat || '',
url: `https://data.eastmoney.com/notices/detail/${primary.stock_code || ''}/${it.art_code || ''}.html`,
};
});
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Confirm the symbol actually has announcements on the Eastmoney website with the same filters.
- Broaden or remove ann_type/s_node/f_node filters and retry.
- Inspect the raw JSON (console.log(await resp.json())) to check whether the envelope shape changed.
- Catch CliError with code 'NO_DATA' and treat it as an empty result in your app.
Example fix
// before
try { rows = await getAnnouncements(sym); } catch (e) { throw e; }
// after
try { rows = await getAnnouncements(sym); }
catch (e) {
if (e?.code === 'NO_DATA') rows = [];
else throw e;
} Defensive patterns
Strategy: fallback
Validate before calling
// validate inputs that drive filters before calling: confirm the symbol has filings // e.g. check symbol is a valid 6-digit code / known listing before querying a narrow window
Type guard
const hasList = (data) => Array.isArray(data?.data?.list) && data.data.list.length > 0;
Try / catch
try {
rows = await getAnnouncements(secid);
} catch (e) {
if (e?.code === 'NO_DATA') rows = []; // treat as empty result set
else throw e;
} Prevention
- Treat code === 'NO_DATA' as an empty array in callers
- Broaden ann_type/s_node/f_node filters or extend the date range when a result is expected
- Verify the symbol exists and is listed on Eastmoney
- Log raw JSON occasionally to catch envelope shape changes early
When it happens
Trigger: Querying an obscure/delisted symbol with no announcements in the window; filters (market/ann_type, s_node/f_node) that exclude all items; a changed response shape where list moved elsewhere so Array.isArray(data?.data?.list) is false.
Common situations: Newly listed or rarely reporting companies with no filings; wrong date range/column filters; Eastmoney silently altering the JSON envelope after a site update so data.data.list is undefined.
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
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/f338645673da08e5.
Report an issue: GitHub.