{"record":{"id":"8e4b796813971000","repo":"jackwener/OpenCLI","slug":"unexpected-dribbble-identity-response-json-stri","errorCode":null,"errorMessage":"Unexpected Dribbble identity response: ${JSON.stringify(result)}","messagePattern":"Unexpected Dribbble identity response: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/dribbble/auth.js","lineNumber":28,"sourceCode":"    // Dribbble serves an AWS WAF challenge before the real document on fresh\n    // tabs. Three seconds is not enough consistently; probing early turns a\n    // valid session into a false AUTH_REQUIRED result.\n    await page.wait(5);\n    const result = await page.evaluate(`(() => {\n        const profile = document.querySelector('a[title=\"Open profile\"]');\n        const signOut = document.querySelector('form[action$=\"/session\"] input[name=\"_method\"][value=\"delete\"]');\n        const href = profile?.getAttribute('href') || '';\n        if (!signOut || !/^\\\\/[^/]+$/.test(href)) {\n            return { kind: 'auth', detail: 'Dribbble header does not show a logged-in profile' };\n        }\n        return {\n            ok: true,\n            username: href.slice(1),\n            profile_url: new URL(href, location.href).href,\n        };\n    })()`);\n    if (result?.kind === 'auth') throw new AuthRequiredError(DRIBBBLE_HOST, result.detail);\n    if (!result?.ok) throw new CommandExecutionError(`Unexpected Dribbble identity response: ${JSON.stringify(result)}`);\n    return { username: result.username, profile_url: result.profile_url };\n}\n\nregisterSiteAuthCommands({\n    site: 'dribbble',\n    domain: DRIBBBLE_HOST,\n    loginUrl: `${DRIBBBLE_ORIGIN}/session/new`,\n    columns: ['username', 'profile_url'],\n    quickCheck: hasDribbbleSessionCookie,\n    verify: verifyDribbbleIdentity,\n    poll: async (page) => {\n        if (!await hasDribbbleSessionCookie(page)) {\n            throw new AuthRequiredError(DRIBBBLE_HOST, 'Waiting for Dribbble session cookies');\n        }\n        return verifyDribbbleIdentity(page);\n    },\n});\n","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/dribbble/auth.js#L10-L46","documentation":"A CommandExecutionError raised by verifyDribbbleIdentity when the in-page identity probe returns something other than ok:true or kind:'auth' — i.e. an unexpected response shape from the page script (null/undefined result or an unanticipated kind). The full result is JSON-stringified into the message for diagnosis.","triggerScenarios":"Calling `dribbble auth` when the page.evaluate identity script throws, returns null, or returns a novel result shape — e.g. the real document never loaded (WAF block page), a CAPTCHA interstitial, or a Dribbble DOM change breaking the script's assumptions.","commonSituations":"AWS WAF serving a hard block (not the challenge) so the probe returns null; Dribbble redesign changing the profile-link selector the script reads; browser tab closed/crashed before evaluation completes.","solutions":["Inspect the JSON in the error message to see what the page actually returned (null vs unexpected kind).","Retry after a longer wait — if the WAF challenge page is what the probe saw, a slow load is the usual culprit.","Log into dribbble.com manually in the managed browser and confirm the profile page renders normally.","Update the CLI package if the JSON shows selectors/shapes the page no longer produces (Dribbble DOM change)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function dribbbleAuthWithRetry(retries = 2) {\n  for (let i = 0; i <= retries; i++) {\n    try {\n      return await run('dribbble auth');\n    } catch (e) {\n      if (e.name === 'CommandExecutionError' && /Unexpected Dribbble identity response/.test(e.message) && i < retries) {\n        await new Promise(r => setTimeout(r, 5000)); // let WAF challenge finish\n        continue;\n      }\n      throw e;\n    }\n  }\n}","preventionTips":["Retry with backoff — transient WAF/challenge pages are the usual cause of null/unexpected results.","Inspect the embedded JSON payload before assuming a code bug.","Keep the CLI updated in case Dribbble's DOM changed and the probe selectors are stale."],"tags":["command-execution","dribbble","scraping","unexpected-response"],"backgroundTag":"unexpected-response-shape","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}