{"record":{"id":"ca0e13a475688a28","repo":"alibaba/nacos","slug":"callinterfaces-must-be-a-non-empty-json-array","errorCode":null,"errorMessage":"callInterfaces must be a non-empty JSON array","messagePattern":"callInterfaces must be a non-empty JSON array","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"console-ui/src/pages/AI/agent-console-model.js","lineNumber":326,"sourceCode":"  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}\n\nfunction serializeProvider(values) {\n  const name = String(values.providerName || '').trim();\n  const url = String(values.providerUrl || '').trim();\n  if (!name && !url) {\n    return undefined;\n  }\n  if (!name) {\n    throw new Error('providerName is required when providerUrl is set');\n  }\n  return JSON.stringify(url ? { name, url } : { name });\n}\n\nfunction serializeTags(value) {\n  const tags = String(value || '')","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console-ui/src/pages/AI/agent-console-model.js#L308-L344","documentation":"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.","triggerScenarios":"Manually editing the callInterfaces JSON to an object, a primitive, or an empty array '[]' in raw JSON mode.","commonSituations":"User clears the callInterfaces field to '[]' or pastes an object instead of an array.","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."],"exampleFix":"// before\ncallInterfaces = '[]'\n\n// after\ncallInterfaces = '[{\"protocol\":\"custom\",\"protocolVersion\":\"1.0.0\",\"descriptorMediaType\":\"application/json\",\"nativeDescriptor\":{}}]'","handlingStrategy":"validation","validationCode":"function isNonEmptyJsonArray(text) {\n  let p;\n  try { p = JSON.parse(text); } catch { return false; }\n  return Array.isArray(p) && p.length > 0;\n}","typeGuard":"function isNonEmptyArray(v) {\n  return Array.isArray(v) && v.length > 0;\n}","tryCatchPattern":"try {\n  serializeCallInterfaces(values, undefined);\n} catch (e) {\n  Message.error(e.message); // 'callInterfaces must be a non-empty JSON array'\n  return;\n}","preventionTips":["Prefer the structured protocol editor over raw JSON.","Seed callInterfaces from DEFAULT_CALL_INTERFACES.","Validate the array on blur."],"tags":["validation","agent","call-interfaces","json","frontend"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}