{"record":{"id":"97b964998f533c0f","repo":"koala73/worldmonitor","slug":"iso2-must-be-an-iso-3166-1-alpha-2-code-such-as","errorCode":null,"errorMessage":"iso2 must be an ISO 3166-1 alpha-2 code, such as \"DE\" or \"IR\".","messagePattern":"iso2 must be an ISO 3166-1 alpha-2 code, such as \"DE\" or \"IR\"\\.","errorType":"validation","errorClass":"SafeWebMcpError","httpStatus":null,"severity":"error","filePath":"src/services/webmcp.ts","lineNumber":1712,"sourceCode":"    ...(result.tab ? { tab: boundedText(result.tab, 32) } : {}),\n    ...(result.reason ? { reason: boundedText(result.reason, 64) } : {}),\n    message: boundedText(result.message, 240),\n    context: {},\n  };\n  const envelopeChars = JSON.stringify(envelope).length;\n  // `\"context\":{}` is already in the envelope; the empty object is 2 chars.\n  const contextBudget = Math.max(0, NAVIGATION_MAX_OUTPUT_CHARS - envelopeChars + 2);\n  const bounded = {\n    ...envelope,\n    context: boundDashboardContext(result.context ?? EMPTY_NAV_CONTEXT, contextBudget),\n  };\n  if (JSON.stringify(bounded).length > NAVIGATION_MAX_OUTPUT_CHARS) {\n    throw new SafeWebMcpError('Dashboard navigation result exceeded the safe output limit.');\n  }\n  return bounded;\n}\n\nasync function applyDashboardTabAction(\n  action: DashboardTabAction,\n  app: WebMcpAppBindings,\n  options?: WebMcpExecutionOptions,\n): Promise<DashboardTabActionResult> {\n  const result = await app.applyDashboardTabAction(action, options);\n  return isDashboardTabListSnapshot(result)\n    ? boundDashboardTabList(result, action.type === 'list' ? action.cursor : undefined)\n    : boundDashboardTabMutation(result);\n}\n\nfunction hasOnlyOwnKeys(\n  value: Record<string, unknown>,\n  allowedKeys: readonly string[],\n): boolean {\n  const allowed = new Set(allowedKeys);\n  return Object.keys(value).every((key) => allowed.has(key));\n}\n","sourceCodeStart":1694,"sourceCodeEnd":1730,"githubUrl":"https://github.com/koala73/worldmonitor/blob/e586b8b4b80f595aa7ece295eec10d76f2921240/src/services/webmcp.ts#L1694-L1730","documentation":"Validation error text for the open_country_brief WebMCP tool's iso2 argument. The guard fires when iso2 is not a two-letter uppercase ISO 3166-1 alpha-2 country code (lowercase, three letters, digits, or wrong casing), as enforced by the ^[A-Z]{2}$ pattern; examples like DE or IR show the expected format. Opening the brief can consume daily briefing quota; use focus_country to only pan the map.","triggerScenarios":"Thrown at src/services/webmcp.ts:556 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a valid ISO 3166-1 alpha-2 country code: exactly two uppercase letters (e.g. \"DE\", \"IR\", \"US\"). Uppercase the input and trim whitespace before validating.","Validate against /^[A-Z]{2}$/ plus, if strictness is required, a known-code list; reject early with this message and the received value so the caller can self-correct."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e586b8b4b80f595aa7ece295eec10d76f2921240","analyzedAt":"2026-08-27T19:53:08.521Z","contentChangedAt":"2026-08-27T19:53:08.521Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}