{"record":{"id":"9ff64030f5a23f5c","repo":"alibaba/nacos","slug":"agentcard-interface-must-be-a-json-object-9ff640","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":"error","filePath":"console-ui-next/src/pages/newAgent/agent-console-model.ts","lineNumber":201,"sourceCode":"  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(\n  value: unknown,\n  fallbackTransport?: string,\n  fallbackVersion?: string,\n): Record<string, unknown> {\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  endpointKey(url, optionalString(value.protocolBinding)\n    || optionalString(value.transport)\n    || fallbackTransport\n    || '');\n  const protocolBinding = validateTransport(\n    optionalString(value.protocolBinding)\n      || optionalString(value.transport)\n      || fallbackTransport\n      || '',\n  );\n  const protocolVersion = required(\n    optionalString(value.protocolVersion) || fallbackVersion || '',\n    'AgentCard interface protocolVersion',\n  );\n  return {\n    ...value,","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console-ui-next/src/pages/newAgent/agent-console-model.ts#L183-L219","documentation":"Thrown by normalizeA2aInterface when an element of the AgentCard's supportedInterfaces array is not a plain object. The function expects each interface entry to be a JSON object with fields like url, protocolBinding, transport. Primitives, arrays, or null are rejected before any field extraction.","triggerScenarios":"The AgentCard's supportedInterfaces contains a string, number, null, or an array instead of an interface object, e.g. [{\"url\":\"...\"}, \"grpc\"] or supportedInterfaces: \"http\".","commonSituations":"Manually authoring an AgentCard JSON and putting a transport name directly in the array instead of an object. Schema mismatch between the editor and the A2A spec.","solutions":["Ensure every element of supportedInterfaces is an object, e.g. {\"url\":\"https://...\",\"transport\":\"GRPC\"}.","Validate the AgentCard against the A2A AgentCard JSON schema before submission.","If a single string transport was intended, wrap it: replace \"grpc\" with {\"transport\":\"GRPC\",\"url\":\"https://...\"}."],"exampleFix":"// before\n{\"supportedInterfaces\":[\"GRPC\",\"HTTP\"]}\n\n// after\n{\"supportedInterfaces\":[{\"url\":\"https://a.example.com\",\"transport\":\"GRPC\"}]}","handlingStrategy":"type-guard","validationCode":"function checkInterfaces(arr) { arr.forEach((it) => { if (it === null || Array.isArray(it) || typeof it !== 'object') throw new Error('Each interface must be an object'); }); }","typeGuard":"function isInterfaceObject(v: unknown): v is Record<string, unknown> {\n  return v !== null && !Array.isArray(v) && typeof v === 'object';\n}","tryCatchPattern":"try { normalizeA2aAgentCard(name, ver, text); } catch (e) {\n  if (/AgentCard interface must be a JSON object/.test(e.message)) { toast.error('supportedInterfaces entries must be objects'); }\n}","preventionTips":["Validate each supportedInterfaces entry is an object","Provide a JSON schema for AgentCard","Use a structured interface editor"],"tags":["validation","agentcard","a2a","interface"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}