alibaba/nacos · warning · Error
callInterfaces must be a non-empty JSON array
Error message
callInterfaces must be a non-empty JSON array
What it means
Thrown by serializeCallInterfaces() in agent-console-model when no structured protocol editors are used and the raw callInterfaces JSON text is present but either is not a JSON array or is an empty array. Call interfaces must be a non-empty JSON array.
Source
Thrown at console-ui/src/pages/AI/agent-console-model.js:326
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);
}
function serializeProvider(values) {
const name = String(values.providerName || '').trim();
const url = String(values.providerUrl || '').trim();
if (!name && !url) {
return undefined;
}
if (!name) {
throw new Error('providerName is required when providerUrl is set');
}
return JSON.stringify(url ? { name, url } : { name });
}
function serializeTags(value) {
const tags = String(value || '')View on GitHub (pinned to 9b989acdf1)
Solutions
- Provide a non-empty JSON array of call interface objects.
- Use the structured protocol editor instead of raw JSON to avoid format mistakes.
- Start from DEFAULT_CALL_INTERFACES as a template.
Example fix
// before
callInterfaces = '[]'
// after
callInterfaces = '[{"protocol":"custom","protocolVersion":"1.0.0","descriptorMediaType":"application/json","nativeDescriptor":{}}]' Defensive patterns
Strategy: validation
Validate before calling
function isNonEmptyJsonArray(text) {
let p;
try { p = JSON.parse(text); } catch { return false; }
return Array.isArray(p) && p.length > 0;
} Type guard
function isNonEmptyArray(v) {
return Array.isArray(v) && v.length > 0;
} Try / catch
try {
serializeCallInterfaces(values, undefined);
} catch (e) {
Message.error(e.message); // 'callInterfaces must be a non-empty JSON array'
return;
} Prevention
- Prefer the structured protocol editor over raw JSON.
- Seed callInterfaces from DEFAULT_CALL_INTERFACES.
- Validate the array on blur.
When it happens
Trigger: Manually editing the callInterfaces JSON to an object, a primitive, or an empty array '[]' in raw JSON mode.
Common situations: User clears the callInterfaces field to '[]' or pastes an object instead of an array.
Related errors
- Labels must be a JSON object
- ${name} must be valid JSON
- ${name} must be a JSON object
- Agent direct-online request must contain callInterfaces
- Online Agent Version must contain callInterfaces
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/ca0e13a475688a28.
Report an issue: GitHub.