{"record":{"id":"5e7cdac3b4f7e2fc","repo":"jackwener/OpenCLI","slug":"unexpected-coupang-probe-json-stringify-probe","errorCode":null,"errorMessage":"Unexpected Coupang probe: ${JSON.stringify(probe)}","messagePattern":"Unexpected Coupang probe: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/coupang/auth.js","lineNumber":32,"sourceCode":"  await page.wait(3);\n  const probe = await page.evaluate(`\n    (() => {\n      if (/login\\\\.coupang\\\\.com\\\\/login/.test(location.href)) {\n        return { kind: 'auth', detail: 'Coupang mypage redirected to login — anonymous' };\n      }\n      if (/Access Denied/i.test(document.title)) {\n        return { kind: 'auth', detail: 'Coupang Access Denied — anti-bot or non-KR IP' };\n      }\n      const el = document.querySelector('.my-nickname, .member-name, .mp-user-info-name, [class*=memberName]');\n      const name = (el?.textContent || '').trim();\n      if (!name) {\n        return { kind: 'auth', detail: 'Coupang mypage 200 but no member-name surface' };\n      }\n      return { ok: true, name };\n    })()\n  `);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('coupang.com', probe.detail);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Coupang probe: ${JSON.stringify(probe)}`);\n  return { name: probe.name };\n}\n\nregisterSiteAuthCommands({\n  site: 'coupang',\n  domain: 'coupang.com',\n  loginUrl: 'https://login.coupang.com/login/login.pang',\n  columns: ['name'],\n  verify: verifyCoupangIdentity,\n  poll: async (page) => {\n    if (!await hasCoupangSessionCookie(page)) {\n      throw new AuthRequiredError('coupang.com', 'Waiting for Coupang session cookies');\n    }\n    return verifyCoupangIdentity(page);\n  },\n});\n","sourceCodeStart":14,"sourceCodeEnd":49,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coupang/auth.js#L14-L49","documentation":"CommandExecutionError thrown by verifyCoupangIdentity when the in-page probe returns something that is neither {kind:'auth'} nor {ok:true} — e.g. null/undefined (evaluate returned nothing, page crashed, navigation failed) or an unexpected shape. Unlike the auth cases, this indicates an unexpected runtime state, not a clean 'not logged in' answer.","triggerScenarios":"page.evaluate returning null/undefined (navigation interrupted, page.goto failed silently, evaluate sandbox error); probe object with unexpected structure after Coupang markup/JS changes; the 3-second page.wait being insufficient so the probe ran against an intermediate page.","commonSituations":"Flaky network or slow mypage load; Coupang serving a challenge/interstitial page that returns an unrecognized shape; regression in the evaluate snippet string (escaping errors); browser tab closed mid-verification.","solutions":["Read the JSON.dumped probe in the message to see the actual value and diagnose from there","Retry verification — transient slowness is the most common cause","Increase the wait after page.goto('/np/mypage') (currently page.wait(3)) if mypage loads slowly","Verify evaluate snippet executes correctly in Chrome DevTools on mypage; fix escaping/marker mismatch if probe is null"],"exampleFix":"// before\n await page.goto('https://www.coupang.com/np/mypage');\n await page.wait(3);\n// after\n await page.goto('https://www.coupang.com/np/mypage', { waitUntil: 'networkidle' });\n await page.wait(5);","handlingStrategy":"retry","validationCode":"// ensure mypage loaded before probing\nawait page.goto('https://www.coupang.com/np/mypage', { waitUntil: 'networkidle' });\nif (!/mypage|쿠팡/.test(await page.evaluate(() => document.title))) {\n  throw new Error('mypage did not load as expected');\n}","typeGuard":"function isOkProbe(probe) {\n  return probe != null && typeof probe === 'object' && probe.ok === true && typeof probe.name === 'string' && probe.name.length > 0;\n}","tryCatchPattern":"try {\n  const identity = await coupangVerify(page);\n} catch (err) {\n  if (/Unexpected Coupang probe/.test(err.message)) {\n    const raw = err.message.match(/Unexpected Coupang probe: (.*)$/)?.[1];\n    console.warn(`probe=${raw} — retrying once`);\n    await sleep(3000);\n    return coupangVerify(page);\n  }\n  throw err;\n}","preventionTips":["Retry verification on flaky networks before treating it as fatal","Increase the post-navigation wait when mypage loads slowly","Parse the JSON probe dump in the error message to diagnose exact cause","Keep the evaluate snippet tested against current Coupang mypage markup"],"tags":["coupang","unexpected-state","page-evaluation"],"backgroundTag":"unexpected-probe-result","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}