{"record":{"id":"d7f6ca1ecc841122","repo":"jackwener/OpenCLI","slug":"failed-to-extract-xiaoe-content-message","errorCode":null,"errorMessage":"Failed to extract xiaoe content: ${message}","messagePattern":"Failed to extract xiaoe content: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/xiaoe/content.js","lineNumber":137,"sourceCode":"  return [{\n    title,\n    content,\n    content_length: content.length,\n    image_count: imageCount,\n  }];\n})()\n`;\n}\n\nasync function getXiaoeContent(page, args) {\n    const url = requireXiaoePageUrl(args.url, 'content');\n    let rows;\n    try {\n        await page.goto(url, { waitUntil: 'load', settleMs: 6000 });\n        rows = await page.evaluate(buildContentScript());\n    } catch (error) {\n        const message = error instanceof Error ? error.message : String(error);\n        throw new CommandExecutionError(\n            `Failed to extract xiaoe content: ${message}`,\n            'page may not have rendered or auth may be required',\n        );\n    }\n    if (!Array.isArray(rows) || rows.length === 0) {\n        throw new EmptyResultError(\n            'xiaoe/content',\n            'No rows returned from page evaluator (page structure may have changed)',\n        );\n    }\n    const row = rows[0];\n    if (!row || typeof row.content !== 'string' || row.content.length === 0) {\n        throw new EmptyResultError(\n            'xiaoe/content',\n            'No article content extracted — login session may have expired or the page renders an empty shell',\n        );\n    }\n    return rows;","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xiaoe/content.js#L119-L155","documentation":"getXiaoeContent navigates a real browser to the xiaoe page and runs an in-page evaluator to extract the article rows. If either page.goto or page.evaluate throws (render failure, navigation error, crashed tab), the error is wrapped in a CommandExecutionError with a hint that the page may not have rendered or auth may be required.","triggerScenarios":"page.goto fails (network error, DNS failure, TLS problem, navigation timeout), or page.evaluate throws inside buildContentScript (DOM not as expected, script runtime error, page navigation during evaluate).","commonSituations":"Offline machine or corporate proxy blocking h5.xet.citv.cn; expired cookies causing a redirect loop; page heavy JS SPA that times out before 'load'; site DOM changed breaking the content script.","solutions":["Check network connectivity/proxy and retry the command","Re-authenticate the xiaoe session (refresh cookies) and retry","Retry once — transient render/navigation flakes are common","Check the inner error message (embedded in this message) for the root cause, e.g. timeout vs JS exception"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check reachability before invoking\nconst res = await fetch('https://h5.xet.citv.cn/', { method: 'HEAD' }).catch(() => null);\nif (!res || !res.ok) throw new Error('h5.xet.citv.cn unreachable — fix network/proxy first');","typeGuard":"null","tryCatchPattern":"try {\n  const rows = await getXiaoeContent(url);\n} catch (e) {\n  if (e.name === 'CommandExecutionError' && e.message.startsWith('Failed to extract xiaoe content')) {\n    console.error('Extraction failed:', e.message, '— hint:', e.hint);\n    // inspect inner cause, check auth, retry once\n  } else throw e;\n}","preventionTips":["Verify network/proxy access to h5.xet.citv.cn before batch runs","Refresh the xiaoe login session before long extractions","Retry once on transient navigation failures","Read the inner message after 'Failed to extract xiaoe content:' for the exact cause"],"tags":["browser-automation","page-navigation","xiaoe"],"backgroundTag":"page-extraction-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}