koala73/worldmonitor · error · SafeWebMcpError

query must not be empty.

Error message

query must not be empty.

What it means

A SafeWebMcpError of kind 'validation' thrown by the search_dashboard WebMCP tool when the query argument is an empty string (zero length). It fires after the string-type and max-length checks, rejecting queries that carry no search terms and would return meaningless default results. It is a generic empty-input validation guard; the input at fault is a query of ''. Callers must supply a non-empty search string.

Solutions

  1. Provide at least one non-whitespace search term
  2. Validate non-empty input in the calling client before invoking the tool
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/services/webmcp.ts:768 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/services/webmcp.ts:2550

      annotations: { readOnlyHint: false },
      execute: withBindings(WEBMCP_SPA_TOOL.setTimeRange, async (args, extra) => (
        applyDashboardAction({
          type: 'set_time_range',
          timeRange: args.timeRange,
        }, app, extra)
      ), trackEvent),
    },
    {
      name: WEBMCP_SPA_TOOL.focusCountry,
      title: 'Focus Country On Map',
      description:
        'Focus the visible map on a country bounding box by ISO 3166-1 alpha-2 code without opening a country brief or consuming briefing quota.',
      inputSchema: {
        type: 'object',
        properties: {
          iso2: {
            type: 'string',
            description: 'ISO 3166-1 alpha-2 country code, uppercase.',
            pattern: DASHBOARD_COUNTRY_CODE_PATTERN,
          },
        },
        required: ['iso2'],
        additionalProperties: false,
      },
      annotations: { readOnlyHint: false },
      execute: withBindings(WEBMCP_SPA_TOOL.focusCountry, async (args, extra) => {
        const iso2 = typeof args.iso2 === 'string' ? args.iso2.toUpperCase() : '';
        if (!ISO2.test(iso2)) {
          throw new SafeWebMcpError(
            'iso2 must be an ISO 3166-1 alpha-2 code, such as "DE" or "IR".',
            'validation',
          );
        }
        return applyDashboardAction({
          type: 'focus_country',
          iso2,

View on GitHub (pinned to e586b8b4b8)