jackwener/OpenCLI · error · AuthRequiredError

dianping.com

Error message

dianping.com

What it means

detectAuthOrPageFailure inspects the rendered page text and final URL of a dianping request. When the signal matches captcha indicators (verify.meituan.com, verifyimg, 身份核实, 请依次点击, 美团安全验证, Yoda) it throws AuthRequiredError('dianping.com', ...) telling you the request was blocked by Meituan's Yoda icon-tap captcha. Dianping short-circuits HTML to this captcha when its bot checks trip, so no real data was rendered.

Source

Thrown at clis/dianping/utils.js:107

    return Promise.resolve()
        .then(fn)
        .catch((err) => {
            if (err?.code) throw err;
            const message = err?.message || String(err);
            throw new CommandExecutionError(`dianping ${label} failed: ${message}`);
        });
}

/**
 * Throw the right typed error for a dianping page that didn't render data.
 * The site short-circuits HTML when bot/login checks trip — typically
 * redirects to verify.meituan.com (Yoda icon-tap captcha) or to a login
 * page when the cookie is missing.
 */
export function detectAuthOrPageFailure({ text = '', url = '' }, contextHint, { emptyPatterns = [] } = {}) {
    const signal = `${url} ${text}`;
    if (/verify\.meituan\.com|verifyimg|身份核实|请依次点击|美团安全验证|Yoda/i.test(signal)) {
        throw new AuthRequiredError(
            'dianping.com',
            `dianping ${contextHint} blocked by captcha — open ${url || 'www.dianping.com'} manually in this profile and solve the captcha, then retry`,
        );
    }
    if (/login\.dianping\.com|account\.dianping\.com|请先登录|未登录|请登录/.test(signal)) {
        throw new AuthRequiredError(
            'dianping.com',
            `dianping ${contextHint} requires login — sign in to dianping.com in this profile, then retry`,
        );
    }
    if (emptyPatterns.some((pattern) => pattern.test(signal))) {
        throw new EmptyResultError(`dianping ${contextHint}`);
    }
    const sample = text ? `; sample: ${String(text).slice(0, 160)}` : '';
    throw new CommandExecutionError(
        `dianping ${contextHint} did not render expected data${sample}`,
        'This usually means dianping changed its HTML, returned an unexpected error page, or the browser profile hit an unrecognized anti-bot state.',
    );

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open the reported URL (or www.dianping.com) manually in the same browser profile and solve the captcha, then retry the command.
  2. Slow down: add delays between requests and reduce request volume per profile.
  3. Refresh/replace the dianping login cookies with a freshly authenticated session.
  4. Run non-headless (or with a more realistic fingerprint) and avoid datacenter IPs; if it recurs, wait before retrying to let the rate-limit cool down.
Defensive patterns

Strategy: retry

Validate before calling

// quick session probe before scraping
const res = await page.goto('https://www.dianping.com');
const signal = `${page.url()} ${await page.content()}`;
if (/verify\.meituan\.com|verifyimg|身份核实|请依次点击|美团安全验证|Yoda/i.test(signal)) {
  throw new Error('captcha pending — solve it in the browser profile first');
}

Type guard

function isAuthRequiredError(err) {
  return err instanceof Error && err.code === 'AUTH_REQUIRED' && /captcha/i.test(err.message || '');
}

Try / catch

try {
  await dianpingSearch(args);
} catch (err) {
  if (err.code === 'AUTH_REQUIRED' && /captcha/i.test(err.message)) {
    console.error('Solve the captcha in the browser profile, then rerun.');
    process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

Trigger: Any dianping step that calls detectAuthOrPageFailure while the page URL/text contains a meituan verification redirect — typically after several automated requests from one cookie profile, an aged/flagged cookie, or a headless fingerprint that trips anti-bot checks.

Common situations: Scraping many search pages back-to-back from the same profile, running headless with default browser flags, reusing a cookie jar that dianping has flagged, or a datacenter IP making the session suspicious.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/42d03944c29d589c. Report an issue: GitHub.