jackwener/OpenCLI · error · CommandExecutionError

dongchedi ${contextHint} returned no __NEXT_DATA__

Error message

dongchedi ${contextHint} returned no __NEXT_DATA__

What it means

A CommandExecutionError raised in dcdFetchPageProps (clis/dongchedi/utils.js:100) when the page's `__NEXT_DATA__` blob parses but its pageProps contains only Dongchedi's housekeeping fallback-shell keys (`__hasUrlCity`, `is_gray`, `has_gray`, `clientIp`, `sensitiveSeriesIdList`) and no real page data. This is the site's empty 'city gateway / soft 404' shell, meaning the requested resource does not exist under that URL form.

Source

Thrown at clis/dongchedi/utils.js:100

        });
    } catch (err) {
        throw new CommandExecutionError(
            `dongchedi ${contextHint} network error: ${err?.message || err}`,
        );
    }
    if (!resp.ok) {
        throw new CommandExecutionError(`dongchedi ${contextHint} HTTP ${resp.status}`);
    }
    const html = await resp.text();
    const pp = extractPageProps(html);
    if (!pp) {
        throw new CommandExecutionError(
            `dongchedi ${contextHint} returned no __NEXT_DATA__`,
            'Dongchedi likely changed its page structure, or the request hit an anti-bot page.',
        );
    }
    if (isFallbackShell(pp)) {
        throw new CommandExecutionError(
            `dongchedi ${contextHint}`,
            'Dongchedi served its empty fallback shell — the id may not exist or the URL form changed.',
        );
    }
    return pp;
}

export function assertPlainObject(value, label) {
    if (!value || typeof value !== 'object' || Array.isArray(value)) {
        throw new CommandExecutionError(`${label} returned an unexpected payload shape; expected an object.`);
    }
    return value;
}

export function requireArray(value, label) {
    if (!Array.isArray(value)) {
        throw new CommandExecutionError(`${label} returned an unexpected payload shape; expected an array.`);
    }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the id by opening `https://www.dongchedi.com/auto/series/<id>` in a browser — if you land on the empty gateway page, the id doesn't exist.
  2. Re-obtain the correct series_id from a fresh dongchedi search (use Chinese model names) rather than reusing cached/stale ids.
  3. Check the URL path form matches the library's expected route (e.g. `/auto/series/<numeric-id>`).
  4. Catch CommandExecutionError and treat this case as 'resource not found' in the caller.

Example fix

// before
await dcd.specs(999999999); // fallback shell → error
// after
const rows = await dcd.search("汉兰达");
await dcd.specs(rows[0].series_id); // resolve a live id first
Defensive patterns

Strategy: validation

Validate before calling

function looksLikeSeriesId(id) {
  return /^\d+$/.test(String(id || '').trim()) && String(id) !== '0';
}

Try / catch

try {
  const pp = await dcdFetchPageProps(`/auto/series/${id}`, `specs ${id}`);
} catch (err) {
  if (err instanceof CommandExecutionError && /fallback shell/i.test(err.message)) {
    console.error(`Series ${id} does not exist on Dongchedi; re-resolve via search.`);
  } else throw err;
}

Prevention

When it happens

Trigger: Calling dongchedi specs/models/score/koubei with a series or car id that does not exist, a series_id taken from a stale or wrong source, or an incorrect URL path form (the id is valid but the route pattern changed or was mistyped).

Common situations: Hard-coded ids copied from an old database or another site's ids (Dongchedi ids are not interchangeable with autohome/etc.), deleted or merged series, and typos in id paths after refactoring.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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