jackwener/OpenCLI · error · AuthRequiredError
coupang.com
Error message
coupang.com
What it means
This AuthRequiredError('coupang.com') is thrown when the in-page add-to-cart evaluation reports a logged-out state: the page still shows a login link ('a[href*="login"]' or Korean 로그인 link) and does NOT contain the 마이쿠팡 (My Coupang) text. The library refuses to proceed with add-to-cart because cart operations require an authenticated Coupang session in the attached Chrome profile.
Source
Thrown at clis/coupang/add-to-cart.js:126
func: async (page, kwargs) => {
const rawProductId = kwargs['product-id'];
if (!rawProductId && !kwargs.url) {
throw new ArgumentError('Either --product-id or --url is required');
}
const productId = rawProductId
? requireProductIdArg(rawProductId, 'product-id')
: requireProductIdArg(kwargs.url, '--url');
const targetUrl = canonicalizeProductUrl(kwargs.url, productId);
const finalUrl = targetUrl || canonicalizeProductUrl('', productId);
await page.goto(finalUrl).catch((error) => {
throw new CommandExecutionError(`coupang add-to-cart navigation failed: ${error?.message || error}`);
});
const result = await page.evaluate(buildAddToCartEvaluate(productId)).catch((error) => {
throw new CommandExecutionError(`coupang add-to-cart evaluation failed: ${error?.message || error}`);
});
const loginHints = result?.loginHints ?? {};
if (loginHints.hasLoginLink && !loginHints.hasMyCoupang) {
throw new AuthRequiredError('coupang.com', 'Please log into Coupang in Chrome and retry.');
}
const actualProductId = normalizeProductId(result?.currentProductId || productId);
if (result?.reason === 'PRODUCT_MISMATCH') {
const observed = actualProductId ? `got ${actualProductId}` : 'no product id observed';
throw new CommandExecutionError(`Product mismatch: expected ${productId}, ${observed}`);
}
if (result?.reason === 'OPTION_REQUIRED') {
throw new CommandExecutionError('This product requires option selection and is not supported in v1.');
}
if (result?.reason === 'ADD_TO_CART_BUTTON_NOT_FOUND') {
throw new CommandExecutionError('Could not find an add-to-cart button on the product page.');
}
if (!result?.ok) {
throw new CommandExecutionError('Failed to confirm add-to-cart success.');
}
return [{
ok: true,
product_id: actualProductId || productId,View on GitHub (pinned to 49907e53dc)
Solutions
- Open Coupang in the controlled Chrome profile and log in at https://login.coupang.com/login/login.pang, then retry
- Verify the correct Chrome profile/user-data-dir is attached (one that has an existing Coupang session)
- Confirm session cookies AID/MEMBER_ID/LMSESSIONID exist for https://www.coupang.com
- Check you are not being served an anonymous/regional variant of Coupang (e.g. non-KR IP redirect)
Example fix
// before coupang add-to-cart --product-id 12345 # AuthRequiredError: coupang.com // after coupang auth login coupang # complete login in Chrome first coupang add-to-cart --product-id 12345
Defensive patterns
Strategy: try-catch
Validate before calling
const cookies = await page.getCookies({ url: 'https://www.coupang.com' });
const loggedIn = cookies.some(c => /^(AID|MEMBER_ID|LMSESSIONID)$/.test(c.name) && c.value);
if (!loggedIn) throw new Error('Log into Coupang before running add-to-cart'); Type guard
function isLoggedIn(loginHints) {
return typeof loginHints === 'object' && loginHints !== null &&
loginHints.hasLoginLink === true && loginHints.hasMyCoupang === false;
} Try / catch
try {
await addToCart(page, productId);
} catch (err) {
if (err instanceof AuthRequiredError && err.site === 'coupang.com') {
console.error('Open Chrome, log into Coupang, then retry.');
return;
}
throw err;
} Prevention
- Log into Coupang in the controlled Chrome profile before automation runs
- Verify session cookies (AID/MEMBER_ID/LMSESSIONID) exist before invoking cart commands
- Run coupang auth verify coupang as a preflight in your script
When it happens
Trigger: Running the coupang add-to-cart command while the controlled Chrome page has no logged-in Coupang session; page.evaluate's loginHints check (hasLoginLink && !hasMyCoupang) fires after evaluation completes. Also fires if Coupang redirected the product page to an anonymous layout.
Common situations: Fresh Chrome profile never logged into Coupang; Coupang session expired (cookies aged out); user logged out manually; testing from an IP/region where Coupang forces anonymous layout.
Related errors
- Bilibili subtitles are hidden behind login for this video. P
- coupang.com
- auth
- AuthRequiredError('gitee.com', 'Waiting for Gitee login')
- grok.com
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/ebd8965181dd1cd2.
Report an issue: GitHub.