{"record":{"id":"4e23d74969109626","repo":"alibaba/nacos","slug":"protocol-must-be-unique-callinterface-protocol","errorCode":null,"errorMessage":"protocol must be unique: ${callInterface.protocol}","messagePattern":"protocol must be unique: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"console-ui/src/pages/AI/agent-console-model.js","lineNumber":299,"sourceCode":"  return result;\n}\n\nfunction serializeOptionalObject(value, name) {\n  if (!String(value || '').trim()) {\n    return undefined;\n  }\n  const parsed = parseJson(value, name);\n  if (!isObject(parsed)) {\n    throw new Error(`${name} must be a JSON object`);\n  }\n  return JSON.stringify(parsed);\n}\n\nfunction validateUniqueProtocols(callInterfaces) {\n  const protocols = new Set();\n  callInterfaces.forEach(callInterface => {\n    if (protocols.has(callInterface.protocol)) {\n      throw new Error(`protocol must be unique: ${callInterface.protocol}`);\n    }\n    protocols.add(callInterface.protocol);\n  });\n  return callInterfaces;\n}\n\nfunction serializeCallInterfaces(values, protocolEditors) {\n  const agentName = required(values.agentName, 'agentName');\n  const version = required(values.version, 'version');\n  if (protocolEditors) {\n    if (protocolEditors.length === 0) {\n      throw new Error('at least one protocol is required');\n    }\n    return JSON.stringify(\n      validateUniqueProtocols(\n        protocolEditors.map(editor => buildStructuredCallInterface(agentName, version, editor))\n      )\n    );","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console-ui/src/pages/AI/agent-console-model.js#L281-L317","documentation":"Thrown by validateUniqueProtocols() in agent-console-model when two or more call interfaces in a structured protocol editor declare the same 'protocol' value. Each call interface must use a unique protocol identifier so the server can route to it unambiguously.","triggerScenarios":"Adding two protocol editors both set to 'custom', or two A2A interfaces resolving to the same protocol binding, then serializing the agent draft.","commonSituations":"User duplicates a protocol editor row and forgets to change the protocol, or two A2A interfaces fall back to the same preferredTransport.","solutions":["Give each call interface a distinct protocol value.","Remove duplicate protocol editor rows.","If using A2A, ensure each interface's protocolBinding differs."],"exampleFix":"// before\n[{protocol:'custom',...},{protocol:'custom',...}]\n\n// after\n[{protocol:'custom',...},{protocol:'a2a',...}]","handlingStrategy":"validation","validationCode":"function hasUniqueProtocols(interfaces) {\n  const seen = new Set();\n  return interfaces.every(i => !seen.has(i.protocol) && seen.add(i.protocol));\n}","typeGuard":null,"tryCatchPattern":"try {\n  validateUniqueProtocols(callInterfaces);\n} catch (e) {\n  Message.error(e.message); // 'protocol must be unique: ...'\n  return;\n}","preventionTips":["Detect duplicate protocols live as editors are added/edited.","Disable the duplicate protocol option in dropdowns already in use.","Show a per-row uniqueness indicator."],"tags":["validation","agent","protocol","duplicate","frontend"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}