{"record":{"id":"5d690eba1f62f01f","repo":"alibaba/nacos","slug":"agentcard-interface-must-be-a-json-object","errorCode":null,"errorMessage":"AgentCard interface must be a JSON object","messagePattern":"AgentCard interface must be a JSON object","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"console-ui/src/pages/AI/agent-console-model.js","lineNumber":145,"sourceCode":"}\n\nfunction sourceMode(order) {\n  const key = (order || []).join(',');\n  switch (key) {\n    case 'RUNTIME,DECLARED':\n      return 'runtime-declared';\n    case 'DECLARED':\n      return 'declared-only';\n    case 'RUNTIME':\n      return 'runtime-only';\n    default:\n      return 'declared-runtime';\n  }\n}\n\nfunction normalizeA2aInterface(value, fallbackTransport, fallbackVersion) {\n  if (!isObject(value)) {\n    throw new Error('AgentCard interface must be a JSON object');\n  }\n  const url = required(optionalString(value.url) || '', 'AgentCard interface url');\n  const protocolBinding = validateTransport(\n    optionalString(value.protocolBinding) ||\n      optionalString(value.transport) ||\n      fallbackTransport ||\n      ''\n  );\n  endpointKey(url, protocolBinding);\n  const protocolVersion = required(\n    optionalString(value.protocolVersion) || fallbackVersion || '',\n    'AgentCard interface protocolVersion'\n  );\n  return { ...value, url, transport: protocolBinding, protocolBinding, protocolVersion };\n}\n\nfunction normalizeA2aAgentCard(agentName, version, text) {\n  const parsed = parseAgentCardJson(required(text, 'agentCard'));","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console-ui/src/pages/AI/agent-console-model.js#L127-L163","documentation":"Thrown by normalizeA2aInterface() in agent-console-model when an element of supportedInterfaces (or additionalInterfaces) is not a JSON object. Each A2A interface entry must be an object containing url, protocolBinding/transport, and protocolVersion.","triggerScenarios":"Submitting an AgentCard whose supportedInterfaces array contains a primitive, null, or a string instead of an object, e.g. \"supportedInterfaces\":[\"https://x\"] or \"supportedInterfaces\":[42].","commonSituations":"Hand-writing an AgentCard JSON with a simplified interface list, or misinterpreting the schema where a bare URL was expected.","solutions":["Make every entry in supportedInterfaces a JSON object with at least a url field.","Use the default card shape as a template: {\"url\":\"...\",\"protocolBinding\":\"HTTP+JSON\",\"protocolVersion\":\"0.3\"}.","Remove null or primitive entries from the array."],"exampleFix":"// before\n\"supportedInterfaces\": [\"https://agent.example.com/a2a\"]\n\n// after\n\"supportedInterfaces\": [{\"url\":\"https://agent.example.com/a2a\",\"protocolBinding\":\"HTTP+JSON\",\"protocolVersion\":\"0.3\"}]","handlingStrategy":"type-guard","validationCode":"function interfacesAreObjects(arr) {\n  return Array.isArray(arr) && arr.every(i => i !== null && !Array.isArray(i) && typeof i === 'object');\n}","typeGuard":"function isInterfaceObject(v) {\n  return v !== null && !Array.isArray(v) && typeof v === 'object';\n}","tryCatchPattern":"try {\n  supportedInterfaces.map(item => normalizeA2aInterface(item, preferredTransport, topProtocolVersion));\n} catch (e) {\n  Message.error(e.message); // 'AgentCard interface must be a JSON object'\n  return;\n}","preventionTips":["Validate each supportedInterfaces entry is an object before normalization.","Use the default card template as a starting point.","Reject null/primitive entries at edit time."],"tags":["validation","agent","a2a","interface","frontend"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}