alibaba/nacos · error · Error
at least one protocol is required
Error message
at least one protocol is required
What it means
Thrown by serializeCallInterfaces when a protocolEditors array is explicitly provided but is empty. An agent must declare at least one callable interface; an empty list is meaningless. Providing undefined (omitting the argument) is allowed and uses the single-interface path.
Source
Thrown at console-ui-next/src/pages/newAgent/agent-console-model.ts:380
if (!value.trim()) {
return undefined;
}
const parsed = parseJson(value, name);
if (parsed === null || Array.isArray(parsed) || typeof parsed !== 'object') {
throw new Error(`${name} must be a JSON object`);
}
return JSON.stringify(parsed);
}
function serializeCallInterfaces(
values: AgentEditorValues,
protocolEditors?: StructuredProtocolEditorValues[],
): string {
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 !== 'raw') {
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');View on GitHub (pinned to 9b989acdf1)
Solutions
- Add at least one protocol editor entry before submitting.
- If no protocols are intended, pass undefined (omit protocolEditors) rather than [] — though the single-interface fallback will still apply.
- Guard the submit handler to block empty protocol lists in the UI.
Example fix
// before serializeCallInterfaces(values, []); // after serializeCallInterfaces(values, [structuredA2aEditor]); // at least one
Defensive patterns
Strategy: validation
Validate before calling
function checkProtocolEditors(editors) {
if (editors && editors.length === 0) throw new Error('Add at least one protocol');
} Type guard
function hasAtLeastOne<T>(arr: T[] | undefined): boolean { return Array.isArray(arr) ? arr.length > 0 : true; } Try / catch
try { serializeCallInterfaces(values, editors); } catch (e) {
if (/at least one protocol is required/.test(e.message)) { toast.error('Add a protocol entry'); }
} Prevention
- Block submit when protocol list is empty
- Pass undefined not [] when no editors
- Require one protocol in the form
When it happens
Trigger: The UI passes an empty array as protocolEditors, e.g. the user removed all protocol editor blocks but still submitted the form.
Common situations: Dynamic form where the user deletes every protocol row. State initialization bug producing [] instead of undefined.
Related errors
- at least one protocol is required
- protocol must be unique: ${callInterface.protocol}
- providerName is required when providerUrl is set
- protocol must be unique: ${callInterface.protocol}
- 10000
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/b83be23cf270f70b.
Report an issue: GitHub.