jackwener/OpenCLI · error · CommandExecutionError

dianping search parser found no result-shaped shop cards

Error message

dianping search parser found no result-shaped shop cards

What it means

The dianping search adapter fetched a results page but its extraction produced zero rows shaped like shop cards, even though the page did not match any of the known 'no results' empty-state patterns (没有找到/暂无结果 etc.). This means dianping changed its markup, the page was an anti-bot/captcha wall, or the HTML was truncated, so the parser found nothing it recognized. The library throws instead of returning an empty list so callers do not silently mistake a parsing failure for a legitimate empty result.

Source

Thrown at clis/dianping/search.js:140

            await page.wait(2);
        });

        const result = await wrapDianpingStep(
            `search "${keyword}" extraction`,
            () => page.evaluate(`(${extractSearchRows.toString()})()`),
        );

        if (!result || !result.ok) {
            detectAuthOrPageFailure(
                { text: String(result?.sample || ''), url: String(result?.url || url) },
                `search "${keyword}"`,
                { emptyPatterns: [/没有找到|暂无结果|暂无商户|换个关键词|未找到相关/i] },
            );
        }

        const rows = (result.rows || []).slice(0, limit);
        if (rows.length === 0) {
            throw new CommandExecutionError('dianping search parser found no result-shaped shop cards');
        }
        if (rows.some((row) => !row?.shop_id)) {
            throw new CommandExecutionError('dianping search parser found result cards without shop_id values');
        }
        return rows.map((r) => ({
            rank: r.rank,
            shop_id: r.shop_id,
            name: r.name,
            rating: r.starClass ? Number((Number(r.starClass) / 10).toFixed(1)) : null,
            reviews: parseReviewCount(r.reviewsRaw),
            price: parsePrice(r.priceRaw),
            cuisine: r.cuisine,
            district: r.district,
            url: r.url,
        }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the same query with a different, common keyword (e.g. 火锅) to check whether parsing fails for all queries or only this one.
  2. Print/save the raw HTML for the failing request and inspect whether it is a captcha/verification page or a markup change.
  3. Update the CLI/adapters package to the latest version in case selectors were fixed for a dianping redesign.
  4. Retry from a residential IP or after solving any verification page; add cookies from a logged-in browser session.
  5. If it is a genuine empty result set, treat it as 'no results found' — refine the keyword or city rather than retrying the same query.

Example fix

// before
cli.search({ keyword: 'myquery', city: 'shanghai' }); // throws CommandExecutionError
// after
try {
  const rows = cli.search({ keyword: 'myquery', city: 'shanghai' });
} catch (e) {
  if (String(e.message).includes('no result-shaped shop cards')) {
    console.error('dianping markup changed or no results; inspect raw HTML before retrying');
  } else { throw e; }
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check: use a common keyword and a known-good city
if (!keyword || !keyword.trim()) throw new Error('keyword required');
// note: cannot pre-validate server markup; detect failure via error message

Type guard

function isParserEmptyError(e) {
  return e instanceof Error && /no result-shaped shop cards/.test(e.message);
}

Try / catch

try {
  const rows = await search({ keyword, city });
} catch (e) {
  if (isParserEmptyError(e)) {
    // treat as possible markup change or true empty set; log keyword+city, try alternate keyword
  } else throw e;
}

Prevention

When it happens

Trigger: Calling the dianping search command where the fetched HTML contains no extractable shop cards: dianping redesigned the search results DOM, the request hit a verification/anti-bot page, network middleware stripped or truncated the HTML, or the keyword matches nothing but renders an empty state not covered by emptyPatterns.

Common situations: Dianping front-end redesign breaking CSS selectors; scraping from a datacenter IP triggering a captcha page; a query that yields zero shops while the empty-state text changed; running an outdated version of this CLI after the site changed.

Related errors


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