{"record":{"id":"f824924b0a620f9f","repo":"alibaba/nacos","slug":"providername-is-required-when-providerurl-is-set","errorCode":null,"errorMessage":"providerName is required when providerUrl is set","messagePattern":"providerName is required when providerUrl is set","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"console-ui/src/pages/AI/agent-console-model.js","lineNumber":338,"sourceCode":"    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 || '')\n    .split(',')\n    .map(item => item.trim())\n    .filter(Boolean);\n  return tags.length > 0 ? JSON.stringify(tags) : undefined;\n}\n\nexport function buildDraftCreateData(namespaceId, values, initial, contentMode, protocolEditors) {\n  const result = {\n    namespaceId,\n    agentName: required(values.agentName, 'agentName'),\n    version: required(values.version, 'version'),\n    author: String(values.author || '').trim() || undefined,","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console-ui/src/pages/AI/agent-console-model.js#L320-L356","documentation":"Thrown by serializeProvider() in agent-console-model when the provider URL is filled in but the provider name is left blank. A provider is optional, but if any part is supplied the name becomes mandatory because the server requires a non-empty provider name to persist the entry.","triggerScenarios":"Entering a value in the providerUrl field while leaving providerName empty on the initial agent draft form.","commonSituations":"User knows the provider's website but not its display name, or pastes a URL expecting the name to be auto-derived.","solutions":["Fill in providerName whenever providerUrl is set.","Clear providerUrl if you only have a name and no URL (name alone is valid).","Leave both blank to omit the provider entirely."],"exampleFix":"// before\n{ providerName: '', providerUrl: 'https://acme.io' }\n\n// after\n{ providerName: 'Acme', providerUrl: 'https://acme.io' }","handlingStrategy":"validation","validationCode":"function providerIsValid(values) {\n  const name = String(values.providerName || '').trim();\n  const url = String(values.providerUrl || '').trim();\n  return !url || !!name;\n}","typeGuard":null,"tryCatchPattern":"try {\n  serializeProvider(values);\n} catch (e) {\n  Message.error(e.message); // 'providerName is required when providerUrl is set'\n  return;\n}","preventionTips":["Make providerName required in the UI whenever providerUrl is non-empty.","Clear both fields together when removing a provider.","Validate on blur of either field."],"tags":["validation","agent","provider","required","frontend"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}