{"record":{"id":"6abe46e4d0cd1f3f","repo":"koala73/worldmonitor","slug":"malformed-arguments-6abe46","errorCode":"malformed_arguments","errorMessage":"enabled must be a boolean.","messagePattern":"enabled must be a boolean\\.","errorType":"validation","errorClass":"DashboardPanelCatalogError","httpStatus":null,"severity":"error","filePath":"src/services/webmcp-panel-catalog.ts","lineNumber":173,"sourceCode":"    }\n  }\n\n  const categoryFilter = query.category;\n  if (categoryFilter !== undefined) {\n    if (\n      typeof categoryFilter !== 'string'\n      || !CATEGORY_KEY_RE.test(categoryFilter)\n      || !PANEL_CATEGORY_KEY_SET.has(categoryFilter)\n    ) {\n      throw new DashboardPanelCatalogError(\n        'invalid_category',\n        'category must be a known panel category key.',\n      );\n    }\n  }\n\n  if (query.enabled !== undefined && typeof query.enabled !== 'boolean') {\n    throw new DashboardPanelCatalogError(\n      'malformed_arguments',\n      'enabled must be a boolean.',\n    );\n  }\n  if (query.available !== undefined && typeof query.available !== 'boolean') {\n    throw new DashboardPanelCatalogError(\n      'malformed_arguments',\n      'available must be a boolean.',\n    );\n  }\n\n  const cursor = query.cursor;\n  if (cursor !== undefined) {\n    if (\n      typeof cursor !== 'string'\n      || cursor.length > DASHBOARD_PANEL_ID_MAX_CHARS\n      || !PANEL_ID_RE.test(cursor)\n      || !CANONICAL_PANEL_ID_SET.has(cursor)","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/koala73/worldmonitor/blob/9361220cc013571781071f0206e4d80fd14b2f7f/src/services/webmcp-panel-catalog.ts#L155-L191","documentation":"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'.","triggerScenarios":"Calling listDashboardPanelCatalog(live, { enabled: 'true' }), { enabled: 1 }, { enabled: null } (null !== undefined, so the check fires) — typically from unvalidated wire/MCP tool input.","commonSituations":"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.","solutions":["Coerce wire values: enabled = raw === 'true' ? true : raw === 'false' ? false : undefined, and omit the key when undefined.","Validate typeof query.enabled === 'boolean' before the call; never pass null — omit the property instead.","Catch DashboardPanelCatalogError with reason 'malformed_arguments' to repair and retry with corrected arguments.","Enforce boolean in the tool/JSON schema so malformed values are rejected before reaching this function."],"exampleFix":"// before\nlistDashboardPanelCatalog(live, { enabled: params.enabled }); // 'true' from querystring\n// after\nconst enabled = params.enabled === undefined ? undefined : params.enabled === 'true' || params.enabled === true;\nlistDashboardPanelCatalog(live, typeof enabled === 'boolean' ? { enabled } : {});","handlingStrategy":"validation","validationCode":"const enabled = rawEnabled === undefined || rawEnabled === null\n  ? undefined\n  : rawEnabled === true || rawEnabled === 'true';\nif (enabled !== undefined && typeof enabled !== 'boolean') {\n  throw new Error('enabled filter must be a boolean');\n}","typeGuard":"function isBooleanFilter(value: unknown): value is boolean | undefined {\n  return value === undefined || typeof value === 'boolean';\n}","tryCatchPattern":"try {\n  return listDashboardPanelCatalog(live, query);\n} catch (err) {\n  if (err instanceof DashboardPanelCatalogError && err.reason === 'malformed_arguments') {\n    return listDashboardPanelCatalog(live, {});\n  }\n  throw err;\n}","preventionTips":["Coerce 'true'/'false' strings from URLs and tool payloads to real booleans first.","Omit the property (or use undefined) instead of null when no filter is wanted.","Declare tool input schemas with boolean types to reject malformed values upstream.","Sanitize deserialized filter objects before passing them as query."],"tags":["validation","type-error","panel-catalog","query-parameters"],"backgroundTag":"invalid-argument-value","analyzedSha":"9361220cc013571781071f0206e4d80fd14b2f7f","analyzedAt":"2026-09-01T10:32:37.851Z","contentChangedAt":"2026-09-01T10:32:37.851Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}