jackwener/OpenCLI · error · CliError
FRAMEWORK_CHANGED
FRAMEWORK_CHANGED
Error message
Could not access Vue Router on flk.npc.gov.cn — the site may have been restructured.
What it means
Thrown by navigateViaVueRouter when injected page JavaScript cannot locate the Vue Router instance on flk.npc.gov.cn (the National People's Congress law database). The site is a Vue SPA; the adapter drives its router programmatically, so an inaccessible router implies the site's frontend framework or bundle structure changed. It is raised as a CliError with code FRAMEWORK_CHANGED to signal the adapter — not the user — needs updating.
Source
Thrown at clis/gov-law/shared.js:18
import { CliError } from '@jackwener/opencli/errors';
export async function navigateViaVueRouter(page, query) {
await page.goto('https://flk.npc.gov.cn/index.html');
await page.wait(4);
const routerAvailable = await page.evaluate(`
(async () => {
const app = document.querySelector('#app');
const router = app?.__vue_app__?.config?.globalProperties?.$router;
if (!router) return false;
await router.push({ path: '/search', query: ${JSON.stringify(query)} });
return true;
})()
`);
if (!routerAvailable) {
throw new CliError(
'FRAMEWORK_CHANGED',
'Could not access Vue Router on flk.npc.gov.cn — the site may have been restructured.',
'Please report this issue so the adapter can be updated.',
);
}
await page.wait(5);
}
export async function extractLawResults(page, limit) {
const data = await page.evaluate(`
(async () => {
const normalize = v => (v || '').replace(/\\s+/g, ' ').trim();
for (let i = 0; i < 40; i++) {
if (document.querySelectorAll('.result-item').length > 0) break;
await new Promise(r => setTimeout(r, 500));
}
const results = [];View on GitHub (pinned to 49907e53dc)
Solutions
- Retry later — the site may be down or slow to hydrate rather than restructured
- Report the issue to the adapter maintainers with the date/time so the extraction script can be updated
- Check manually in a browser whether flk.npc.gov.cn still loads its search SPA
- Pin/patch the adapter to the site's new router global or switch to URL-based navigation
Example fix
// before
await navigateViaVueRouter(page, query);
// after
try { await navigateViaVueRouter(page, query); }
catch (e) { if (e.code === 'FRAMEWORK_CHANGED') await page.goto(searchUrlFromQuery(query)); else throw e; } Defensive patterns
Strategy: retry
Validate before calling
// Probe the SPA before navigating
const ok = await page.evaluate(() => {
const app = document.querySelector('#app');
return !!(app && app.__vue_app__);
});
if (!ok) throw new Error('Vue app not mounted; adapter navigation would fail'); Type guard
function isVueRouterAvailable(win) { return !!(win && win.__VUE__ !== undefined || (win.document.querySelector('#app') || {}).__vue__); } Try / catch
try {
await navigateViaVueRouter(page, query);
} catch (err) {
if (err.code === 'FRAMEWORK_CHANGED') {
// site restructured: fall back to direct URL navigation or surface a user-facing notice
await page.goto(buildSearchUrl(query));
} else throw err;
} Prevention
- Wait for Vue app hydration before injecting scripts
- Monitor flk.npc.gov.cn for frontend changes; alert on router-detection failures
- Fall back to direct URL navigation when router detection fails
- Report persistent FRAMEWORK_CHANGED errors to adapter maintainers
When it happens
Trigger: Calling any gov-law command that navigates via navigateViaVueRouter when the injected script's router detection (`window.__VUE__`/router push) fails: the SPA no longer exposes the router on the expected global, the route '/search' was renamed, or the script evaluated before the app hydrated.
Common situations: flk.npc.gov.cn deploying a frontend redesign or framework migration, site temporarily serving an error/login page instead of the SPA, or slow page load so the script runs before Vue mounts.
Related errors
- gov-policy ${command} browser extraction failed: ${error?.me
- ${label} failed: ${error?.message ?? error}
- ${config.site} login
- Failed to extract AIbase daily news: ${getErrorMessage(error
- antigravity cookies: document.cookie is empty.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/595956d855a7f993.
Report an issue: GitHub.