{"record":{"id":"f338645673da08e5","repo":"jackwener/OpenCLI","slug":"no-data-f33864","errorCode":"NO_DATA","errorMessage":"eastmoney returned no announcement data","messagePattern":"eastmoney returned no announcement data","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"warning","filePath":"clis/eastmoney/announcement.js","lineNumber":38,"sourceCode":"  ],\n  columns: ['time', 'code', 'name', 'title', 'category', 'url'],\n  func: async (args) => {\n    const market = String(args.market ?? 'SHA,SZA,BJA').trim() || 'SHA,SZA,BJA';\n    const limit = Math.max(1, Math.min(Number(args.limit) || 20, 100));\n\n    const url = new URL('https://np-anotice-stock.eastmoney.com/api/security/ann');\n    url.searchParams.set('page_size', String(limit));\n    url.searchParams.set('page_index', '1');\n    url.searchParams.set('ann_type', market);\n    url.searchParams.set('client_source', 'web');\n    url.searchParams.set('f_node', '0');\n    url.searchParams.set('s_node', '0');\n\n    const resp = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0' } });\n    if (!resp.ok) throw new CliError('HTTP_ERROR', `announcement failed: HTTP ${resp.status}`);\n    const data = await resp.json();\n    const list = Array.isArray(data?.data?.list) ? data.data.list : [];\n    if (list.length === 0) throw new CliError('NO_DATA', 'eastmoney returned no announcement data');\n\n    return list.slice(0, limit).map((it) => {\n      const primary = Array.isArray(it.codes) && it.codes.length > 0 ? it.codes[0] : {};\n      const cat = Array.isArray(it.columns) && it.columns.length > 0 ? it.columns[0]?.column_name : '';\n      return {\n        time: String(it.notice_date || it.display_time || '').slice(0, 19),\n        code: primary.stock_code || '',\n        name: primary.short_name || '',\n        title: it.title || it.title_ch || '',\n        category: cat || '',\n        url: `https://data.eastmoney.com/notices/detail/${primary.stock_code || ''}/${it.art_code || ''}.html`,\n      };\n    });\n  },\n});\n","sourceCodeStart":20,"sourceCodeEnd":54,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/eastmoney/announcement.js#L20-L54","documentation":"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 [].","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\ntry { rows = await getAnnouncements(sym); } catch (e) { throw e; }\n// after\ntry { rows = await getAnnouncements(sym); }\ncatch (e) {\n  if (e?.code === 'NO_DATA') rows = [];\n  else throw e;\n}","handlingStrategy":"fallback","validationCode":"// validate inputs that drive filters before calling: confirm the symbol has filings\n// e.g. check symbol is a valid 6-digit code / known listing before querying a narrow window","typeGuard":"const hasList = (data) => Array.isArray(data?.data?.list) && data.data.list.length > 0;","tryCatchPattern":"try {\n  rows = await getAnnouncements(secid);\n} catch (e) {\n  if (e?.code === 'NO_DATA') rows = []; // treat as empty result set\n  else throw e;\n}","preventionTips":["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"],"tags":["api","empty-result","eastmoney","no-data"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}