koala73/worldmonitor · error · Error

Country brief panel is not initialised

Error message

Country brief panel is not initialised

What it means

Thrown by the WebMCP open_country_brief tool binding in App.ts. After awaiting this.waitForUiReady(), the binding requires this.state.countryBriefPage to exist; if the general UI finished initializing but the country brief page never mounted, invoking the tool throws this error rather than silently doing nothing.

Solutions

  1. Enable/mount the country brief page before offering open_country_brief to agents — verify state.countryBriefPage is set
  2. Make tool registration or the tool result conditional: return a structured 'panel unavailable' result instead of throwing when this.state.countryBriefPage is falsy
  3. If the panel should be there, check the browser console for country-intel chunk load failures and fix the underlying mount error

Example fix

// before
openCountryBriefByCode: async (code, country) => {
  await this.waitForUiReady();
  if (!this.state.countryBriefPage) throw new Error('Country brief panel is not initialised');
  await this.countryIntel.openCountryBriefByCode(code, country);
},

// after (graceful result instead of throw):
openCountryBriefByCode: async (code, country) => {
  await this.waitForUiReady();
  if (!this.state.countryBriefPage) {
    return { ok: false, status: 'denied', reason: 'country_brief_disabled' } as const;
  }
  await this.countryIntel.openCountryBriefByCode(code, country);
  return { ok: true } as const;
},
Defensive patterns

Strategy: try-catch

Validate before calling

// In the tool host, before dispatching to the panel:
if (!app.state.countryBriefPage) {
  return { ok: false, status: 'denied', reason: 'country_brief_unavailable' };
}

Type guard

function isCountryBriefReady(app: { state: { countryBriefPage: unknown } }): boolean {
  return app.state.countryBriefPage != null;
}

Try / catch

try { await openCountryBrief(code, country); } catch (e) { if (e instanceof Error && e.message === 'Country brief panel is not initialised') informAgent('country brief disabled in this session'); else throw e; }

Prevention

When it happens

Trigger: An agent (browser MCP client) calls open_country_brief during or after startup while the country brief page is disabled in panel settings, failed to mount, or is not part of this build/variant. It is NOT the startup-timeout path: waitForUiReady already resolved, so the UI as a whole is up and only this panel is missing.

Common situations: User disabled the country brief panel in settings before an agent session; the country-intel lazy chunk failed to load (network error) leaving the dashboard otherwise functional; a stripped-down variant that ships WebMCP tools but not every panel.

Related errors


AI-assisted analysis of koala73/worldmonitor@7d06c8633d (2026-08-21). Data as JSON: /api/errors/8c9591f8ad3f8b94. Report an issue: GitHub.

Appendix: source

Thrown at src/App.ts:1893

      if (!this.state.isDestroyed && !actionWasCancelled && !invocationWasCancelled) {
        console.warn('[search] Failed to load search manager:', error);
        if (!options.throwOnFailure) showToast('Search failed to load. Please try again.');
      }
      pendingGate?.cancel();
      if (options.throwOnFailure || options.signal?.aborted) throw error;
      return false;
    } finally {
      // Reset the toggle accumulator once the latest press settles.
      if (this.openSearchEpoch === epoch) this.searchToggleDesiredOpen = false;
    }
  }

  private async waitForSlowBootstrapCheckpoint(): Promise<void> {
    markLcpDebug('wm:data:slow-tier-wait-start');
    try {
      const settled = await waitForBootstrapSlowTier(isDesktopRuntime() ? 8_500 : 3_500);
      markLcpDebug('wm:data:slow-tier-wait-end', { settled });
      if (this.state.isDestroyed) return;
      this.bootstrapHydrationState = getBootstrapHydrationState();
      this.updateConnectivityUi();
    } catch {
      markLcpDebug('wm:data:slow-tier-wait-error');
    }
  }

  private async preloadCountryGeometryForPostLcpWork(): Promise<void> {
    markLcpDebug('wm:data:country-geometry-start');
    try {
      await preloadCountryGeometry();
      markLcpDebug('wm:data:country-geometry-ready');
    } catch {
      markLcpDebug('wm:data:country-geometry-error');
    }
  }

  private startPostLcpIntelligence(countryGeometryReady: Promise<void>, geometryAlreadyApplied: boolean): void {

View on GitHub (pinned to 7d06c8633d)