koala73/worldmonitor · error · DashboardPanelCatalogError

malformed_arguments

malformed_arguments

Error message

enabled must be a boolean.

What it means

listDashboardPanelCatalog() requires query.enabled, when provided, to be a strict boolean, because it is compared with === against each item's enabled flag. Any other runtime type throws DashboardPanelCatalogError with reason 'malformed_arguments'.

Source

Thrown at src/services/webmcp-panel-catalog.ts:173

    }
  }

  const categoryFilter = query.category;
  if (categoryFilter !== undefined) {
    if (
      typeof categoryFilter !== 'string'
      || !CATEGORY_KEY_RE.test(categoryFilter)
      || !PANEL_CATEGORY_KEY_SET.has(categoryFilter)
    ) {
      throw new DashboardPanelCatalogError(
        'invalid_category',
        'category must be a known panel category key.',
      );
    }
  }

  if (query.enabled !== undefined && typeof query.enabled !== 'boolean') {
    throw new DashboardPanelCatalogError(
      'malformed_arguments',
      'enabled must be a boolean.',
    );
  }
  if (query.available !== undefined && typeof query.available !== 'boolean') {
    throw new DashboardPanelCatalogError(
      'malformed_arguments',
      'available must be a boolean.',
    );
  }

  const cursor = query.cursor;
  if (cursor !== undefined) {
    if (
      typeof cursor !== 'string'
      || cursor.length > DASHBOARD_PANEL_ID_MAX_CHARS
      || !PANEL_ID_RE.test(cursor)
      || !CANONICAL_PANEL_ID_SET.has(cursor)

View on GitHub (pinned to 9361220cc0)

Solutions

  1. Coerce wire values: enabled = raw === 'true' ? true : raw === 'false' ? false : undefined, and omit the key when undefined.
  2. Validate typeof query.enabled === 'boolean' before the call; never pass null — omit the property instead.
  3. Catch DashboardPanelCatalogError with reason 'malformed_arguments' to repair and retry with corrected arguments.
  4. Enforce boolean in the tool/JSON schema so malformed values are rejected before reaching this function.

Example fix

// before
listDashboardPanelCatalog(live, { enabled: params.enabled }); // 'true' from querystring
// after
const enabled = params.enabled === undefined ? undefined : params.enabled === 'true' || params.enabled === true;
listDashboardPanelCatalog(live, typeof enabled === 'boolean' ? { enabled } : {});
Defensive patterns

Strategy: validation

Validate before calling

const enabled = rawEnabled === undefined || rawEnabled === null
  ? undefined
  : rawEnabled === true || rawEnabled === 'true';
if (enabled !== undefined && typeof enabled !== 'boolean') {
  throw new Error('enabled filter must be a boolean');
}

Type guard

function isBooleanFilter(value: unknown): value is boolean | undefined {
  return value === undefined || typeof value === 'boolean';
}

Try / catch

try {
  return listDashboardPanelCatalog(live, query);
} catch (err) {
  if (err instanceof DashboardPanelCatalogError && err.reason === 'malformed_arguments') {
    return listDashboardPanelCatalog(live, {});
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling listDashboardPanelCatalog(live, { enabled: 'true' }), { enabled: 1 }, { enabled: null } (null !== undefined, so the check fires) — typically from unvalidated wire/MCP tool input.

Common situations: Query-string values arriving as strings ('?enabled=true'); JSON tool arguments where the agent sent a string; null used intending 'no filter' instead of omitting the key or passing undefined.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of koala73/worldmonitor@9361220cc0 (2026-09-01). Data as JSON: /api/errors/6abe46e4d0cd1f3f. Report an issue: GitHub.