{"record":{"id":"7db7993178b3c32f","repo":"alibaba/nacos","slug":"at-least-one-protocol-is-required","errorCode":null,"errorMessage":"at least one protocol is required","messagePattern":"at least one protocol is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"console-ui/src/pages/AI/agent-console-model.js","lineNumber":311,"sourceCode":"}\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    );\n  }\n  if (values.protocolEditorKind === 'a2a' || values.protocolEditorKind === 'custom') {\n    return JSON.stringify([\n      buildStructuredCallInterface(agentName, version, editorFromValues(values)),\n    ]);\n  }\n  const parsed = parseJson(required(values.callInterfaces, 'callInterfaces'), 'callInterfaces');\n  if (!Array.isArray(parsed) || parsed.length === 0) {\n    throw new Error('callInterfaces must be a non-empty JSON array');\n  }\n  return JSON.stringify(parsed);\n}","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console-ui/src/pages/AI/agent-console-model.js#L293-L329","documentation":"Thrown by serializeCallInterfaces() in agent-console-model when structured protocol editors are supplied (protocolEditors is truthy) but the array is empty. At least one call interface is mandatory for an agent version using direct content mode.","triggerScenarios":"Saving an agent draft in direct content mode after deleting all protocol editor rows, leaving zero protocols.","commonSituations":"User removes every protocol entry intending to add none, or a UI state bug yields an empty editor array.","solutions":["Add at least one protocol editor row (a2a or custom) before saving.","If you do not want call interfaces, switch the content mode away from 'direct'.","Restore the default protocol editor via createStructuredProtocolEditor()."],"exampleFix":"// before\nprotocolEditors = [];\n\n// after\nprotocolEditors = [createStructuredProtocolEditor('a2a', DEFAULT_AGENT_CARD)];","handlingStrategy":"validation","validationCode":"function hasAtLeastOneProtocol(editors) {\n  return Array.isArray(editors) && editors.length > 0;\n}","typeGuard":null,"tryCatchPattern":"try {\n  serializeCallInterfaces(values, protocolEditors);\n} catch (e) {\n  Message.error(e.message); // 'at least one protocol is required'\n  return;\n}","preventionTips":["Disable submit when the protocol editor list is empty.","Seed one default protocol editor on form open.","Warn before allowing the last protocol row to be removed."],"tags":["validation","agent","protocol","required","frontend"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}