alibaba/nacos · warning · Error

at least one protocol is required

Error message

at least one protocol is required

What it means

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.

Source

Thrown at console-ui/src/pages/AI/agent-console-model.js:311

}

function validateUniqueProtocols(callInterfaces) {
  const protocols = new Set();
  callInterfaces.forEach(callInterface => {
    if (protocols.has(callInterface.protocol)) {
      throw new Error(`protocol must be unique: ${callInterface.protocol}`);
    }
    protocols.add(callInterface.protocol);
  });
  return callInterfaces;
}

function serializeCallInterfaces(values, protocolEditors) {
  const agentName = required(values.agentName, 'agentName');
  const version = required(values.version, 'version');
  if (protocolEditors) {
    if (protocolEditors.length === 0) {
      throw new Error('at least one protocol is required');
    }
    return JSON.stringify(
      validateUniqueProtocols(
        protocolEditors.map(editor => buildStructuredCallInterface(agentName, version, editor))
      )
    );
  }
  if (values.protocolEditorKind === 'a2a' || values.protocolEditorKind === 'custom') {
    return JSON.stringify([
      buildStructuredCallInterface(agentName, version, editorFromValues(values)),
    ]);
  }
  const parsed = parseJson(required(values.callInterfaces, 'callInterfaces'), 'callInterfaces');
  if (!Array.isArray(parsed) || parsed.length === 0) {
    throw new Error('callInterfaces must be a non-empty JSON array');
  }
  return JSON.stringify(parsed);
}

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Add at least one protocol editor row (a2a or custom) before saving.
  2. If you do not want call interfaces, switch the content mode away from 'direct'.
  3. Restore the default protocol editor via createStructuredProtocolEditor().

Example fix

// before
protocolEditors = [];

// after
protocolEditors = [createStructuredProtocolEditor('a2a', DEFAULT_AGENT_CARD)];
Defensive patterns

Strategy: validation

Validate before calling

function hasAtLeastOneProtocol(editors) {
  return Array.isArray(editors) && editors.length > 0;
}

Try / catch

try {
  serializeCallInterfaces(values, protocolEditors);
} catch (e) {
  Message.error(e.message); // 'at least one protocol is required'
  return;
}

Prevention

When it happens

Trigger: Saving an agent draft in direct content mode after deleting all protocol editor rows, leaving zero protocols.

Common situations: User removes every protocol entry intending to add none, or a UI state bug yields an empty editor array.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/7db7993178b3c32f. Report an issue: GitHub.