alibaba/nacos · error · Error
callInterfaces must be a non-empty JSON array
Error message
callInterfaces must be a non-empty JSON array
What it means
Thrown in the raw-mode branch of serializeCallInterfaces: the user-supplied callInterfaces JSON parsed but is not a non-empty array. Raw mode requires the value to be a JSON array of interface objects; an object, primitive, null, or empty array is rejected.
Source
Thrown at console-ui-next/src/pages/newAgent/agent-console-model.ts:398
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');
}
return JSON.stringify(parsed);
}
function serializeProvider(values: AgentEditorValues): string | undefined {
const name = values.providerName.trim();
const url = 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: string): string | undefined {
const tags = value.split(',').map((item) => item.trim()).filter(Boolean);View on GitHub (pinned to 9b989acdf1)
Solutions
- Wrap the interface(s) in a JSON array: '[{...}]'.
- Ensure the array has at least one element.
- Use the structured editor instead of raw mode if hand-authoring arrays is error-prone.
Example fix
// before
{"protocol":"A2A","url":"https://a.example.com"}
// after
[{"protocol":"A2A","url":"https://a.example.com"}] Defensive patterns
Strategy: validation
Validate before calling
function checkRawCallInterfaces(text) {
const parsed = JSON.parse(text);
if (!Array.isArray(parsed) || parsed.length === 0) throw new Error('callInterfaces must be a non-empty array');
return parsed;
} Type guard
function isNonEmptyArray(v: unknown): v is unknown[] { return Array.isArray(v) && v.length > 0; } Try / catch
try { serializeCallInterfaces(values); } catch (e) {
if (/non-empty JSON array/.test(e.message)) { toast.error('Wrap interfaces in a non-empty JSON array'); }
} Prevention
- Wrap interfaces in []
- Ensure at least one element
- Use structured editor if raw JSON is error-prone
When it happens
Trigger: User enters a single object '{...}' instead of an array '[{...}]', an empty array '[]', or a non-array value in the raw callInterfaces textarea.
Common situations: Hand-authoring raw JSON and forgetting the outer array. Pasting a single interface object. Empty array from cleared input.
Related errors
- Labels must be a JSON object
- ${name} must be valid JSON
- ${name} must be a JSON object
- callInterfaces must be a non-empty JSON array
- agent.labelsObjectRequired
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/444a95d00ec7b839.
Report an issue: GitHub.