{"record":{"id":"8c9591f8ad3f8b94","repo":"koala73/worldmonitor","slug":"country-brief-panel-is-not-initialised","errorCode":null,"errorMessage":"Country brief panel is not initialised","messagePattern":"Country brief panel is not initialised","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/App.ts","lineNumber":1893,"sourceCode":"      if (!this.state.isDestroyed && !actionWasCancelled && !invocationWasCancelled) {\n        console.warn('[search] Failed to load search manager:', error);\n        if (!options.throwOnFailure) showToast('Search failed to load. Please try again.');\n      }\n      pendingGate?.cancel();\n      if (options.throwOnFailure || options.signal?.aborted) throw error;\n      return false;\n    } finally {\n      // Reset the toggle accumulator once the latest press settles.\n      if (this.openSearchEpoch === epoch) this.searchToggleDesiredOpen = false;\n    }\n  }\n\n  private async waitForSlowBootstrapCheckpoint(): Promise<void> {\n    markLcpDebug('wm:data:slow-tier-wait-start');\n    try {\n      const settled = await waitForBootstrapSlowTier(isDesktopRuntime() ? 8_500 : 3_500);\n      markLcpDebug('wm:data:slow-tier-wait-end', { settled });\n      if (this.state.isDestroyed) return;\n      this.bootstrapHydrationState = getBootstrapHydrationState();\n      this.updateConnectivityUi();\n    } catch {\n      markLcpDebug('wm:data:slow-tier-wait-error');\n    }\n  }\n\n  private async preloadCountryGeometryForPostLcpWork(): Promise<void> {\n    markLcpDebug('wm:data:country-geometry-start');\n    try {\n      await preloadCountryGeometry();\n      markLcpDebug('wm:data:country-geometry-ready');\n    } catch {\n      markLcpDebug('wm:data:country-geometry-error');\n    }\n  }\n\n  private startPostLcpIntelligence(countryGeometryReady: Promise<void>, geometryAlreadyApplied: boolean): void {","sourceCodeStart":1875,"sourceCodeEnd":1911,"githubUrl":"https://github.com/koala73/worldmonitor/blob/7d06c8633d256c18e38133030bc3613976a96ec9/src/App.ts#L1875-L1911","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Enable/mount the country brief page before offering open_country_brief to agents — verify state.countryBriefPage is set","Make tool registration or the tool result conditional: return a structured 'panel unavailable' result instead of throwing when this.state.countryBriefPage is falsy","If the panel should be there, check the browser console for country-intel chunk load failures and fix the underlying mount error"],"exampleFix":"// before\nopenCountryBriefByCode: async (code, country) => {\n  await this.waitForUiReady();\n  if (!this.state.countryBriefPage) throw new Error('Country brief panel is not initialised');\n  await this.countryIntel.openCountryBriefByCode(code, country);\n},\n\n// after (graceful result instead of throw):\nopenCountryBriefByCode: async (code, country) => {\n  await this.waitForUiReady();\n  if (!this.state.countryBriefPage) {\n    return { ok: false, status: 'denied', reason: 'country_brief_disabled' } as const;\n  }\n  await this.countryIntel.openCountryBriefByCode(code, country);\n  return { ok: true } as const;\n},","handlingStrategy":"try-catch","validationCode":"// In the tool host, before dispatching to the panel:\nif (!app.state.countryBriefPage) {\n  return { ok: false, status: 'denied', reason: 'country_brief_unavailable' };\n}","typeGuard":"function isCountryBriefReady(app: { state: { countryBriefPage: unknown } }): boolean {\n  return app.state.countryBriefPage != null;\n}","tryCatchPattern":"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; }","preventionTips":["Only register/advertise the country-brief tool once the panel mounts","Keep panel enablement state in one place so tool availability and UI stay in sync","Watch for country-intel chunk load failures in console when this fires"],"tags":["webmcp","agent-tools","ui-initialisation","country-brief"],"backgroundTag":"component-not-initialised","analyzedSha":"7d06c8633d256c18e38133030bc3613976a96ec9","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}