{"record":{"id":"17f5968b94b01cf6","repo":"jackwener/OpenCLI","slug":"probe-detail-17f596","errorCode":null,"errorMessage":"${probe.detail}","messagePattern":"\\$\\{probe\\.detail\\}","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/quark/auth.js","lineNumber":30,"sourceCode":"    const d = await r.json();\n    const data = d && d.data;\n    const isEmpty = !data || Array.isArray(data) || Object.keys(data).length === 0;\n    if (isEmpty) return { kind: 'auth', detail: 'Quark account/info returned empty data — anonymous' };\n    const nickname = String(data.nickname || data.nick_name || data.name || '');\n    if (!nickname) return { kind: 'render-error', detail: 'Quark account/info populated but no nickname field — response shape drift' };\n    return { ok: true, nickname };\n  } catch (e) {\n    return { kind: 'exception', detail: String(e && e.message || e) };\n  }\n})()`;\n\nasync function verifyQuarkIdentity(page) {\n  await page.goto('https://pan.quark.cn/');\n  await page.wait(2);\n  const probe = await page.evaluate(WHOAMI_PROBE);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('quark.cn', probe.detail);\n  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Quark account/info`);\n  if (probe?.kind === 'render-error') throw new CommandExecutionError(probe.detail);\n  if (probe?.kind === 'exception') throw new CommandExecutionError(`Quark whoami failed: ${probe.detail}`);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Quark probe: ${JSON.stringify(probe)}`);\n  return { nickname: probe.nickname };\n}\n\nregisterSiteAuthCommands({\n  site: 'quark',\n  domain: 'quark.cn',\n  loginUrl: 'https://pan.quark.cn/',\n  columns: ['nickname'],\n  verify: verifyQuarkIdentity,\n  poll: async (page) => {\n    const probe = await page.evaluate(WHOAMI_PROBE);\n    if (!probe?.ok) throw new AuthRequiredError('quark.cn', 'Waiting for Quark login');\n    return { nickname: probe.nickname };\n  },\n});\n","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/quark/auth.js#L12-L48","documentation":"When the WHOAMI_PROBE executed in the Quark page reports kind 'render-error', verifyQuarkIdentity throws this CommandExecutionError carrying the probe's detail string. It means the page rendered but the probe detected an on-page error state (e.g. an error UI or failed script) rather than a clean account/info response. This surfaces when the Quark web app fails to initialize properly in the automated browser.","triggerScenarios":"page.evaluate(WHOAMI_PROBE) returns {kind:'render-error', detail} while verifying quark identity — the DOM/error signal captured by the probe during page load of pan.quark.cn.","commonSituations":"Quark frontend update changing markup that the probe relies on; page loaded in an error/limit state (e.g. captcha or risk-control interstitial); slow network causing partial render; browser environment (old headless Chromium) unsupported by the Quark SPA.","solutions":["Read probe.detail in the message to see the concrete render problem reported by the page.","Re-run after increasing the wait (page.wait(2)) or retrying, since slow loads can produce transient render errors.","Open pan.quark.cn manually in the automated browser to check for captcha/risk-control interstitials and resolve them or use a warmed session.","Update the tool if Quark changed its UI, as the probe's render-error detection may be misfiring on new markup.","Try a different/newer headless browser user-agent if the SPA refuses the current environment."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-check: load the page and confirm a logged-in render marker exists before probing\nawait page.goto('https://pan.quark.cn/');\nawait page.wait(5);\nif (await page.evaluate(() => !!document.querySelector('.login-btn, [class*=login]'))) {\n  throw new Error('Quark page not in logged-in state');\n}","typeGuard":"function isRenderErrorProbe(p) {\n  return !!p && typeof p === 'object' && p.kind === 'render-error' && typeof p.detail === 'string';\n}","tryCatchPattern":"try {\n  await verifyQuarkIdentity(page);\n} catch (e) {\n  if (e instanceof CommandExecutionError && !String(e.message).startsWith('HTTP')) {\n    // render error path: inspect page state, then retry once\n  } else throw e;\n}","preventionTips":["Give the SPA enough wait time before probing","Watch for captcha/risk-control interstitials and resolve them","Use a current headless browser version supported by the Quark frontend","Pin and update the tool when Quark ships UI changes"],"tags":["quark","render","browser-automation","probe"],"backgroundTag":"page-render-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}