{"record":{"id":"1993ab40819a89ee","repo":"alibaba/nacos","slug":"nativedescriptor-must-not-be-json-null","errorCode":null,"errorMessage":"nativeDescriptor must not be JSON null","messagePattern":"nativeDescriptor must not be JSON null","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"console-ui-next/src/pages/newAgent/agent-console-model.ts","lineNumber":324,"sourceCode":"  editor: StructuredProtocolEditorValues,\n): AgentCallInterface {\n  if (editor.protocolEditorKind === 'a2a') {\n    const normalized = normalizeA2aAgentCard(agentName, version, editor.agentCard);\n    return {\n      protocol: 'a2a',\n      protocolVersion: String(normalized.card.protocolVersion),\n      descriptorMediaType: 'application/json',\n      nativeDescriptor: normalized.card,\n      endpointSourceOrder: ['DECLARED', 'RUNTIME'],\n      declaredEndpoints: normalized.declaredEndpoints,\n    };\n  }\n  const nativeDescriptor = parseJson(\n    required(editor.customNativeDescriptor, 'nativeDescriptor'),\n    'nativeDescriptor',\n  );\n  if (nativeDescriptor === null) {\n    throw new Error('nativeDescriptor must not be JSON null');\n  }\n  const seen = new Set<string>();\n  const declaredEndpoints = editor.declaredEndpoints.flatMap((endpoint) => {\n    if (!endpoint.uri.trim() && !endpoint.transport.trim()) {\n      return [];\n    }\n    const uri = required(endpoint.uri, 'Endpoint uri');\n    const transport = validateTransport(endpoint.transport);\n    const key = endpointKey(uri, transport);\n    if (seen.has(key)) {\n      return [];\n    }\n    seen.add(key);\n    return [{ uri, transport }];\n  });\n  return {\n    protocol: required(editor.customProtocol, 'protocol'),\n    protocolVersion: editor.customProtocolVersion.trim() || undefined,","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console-ui-next/src/pages/newAgent/agent-console-model.ts#L306-L342","documentation":"Thrown when the custom nativeDescriptor JSON parses successfully but its value is exactly JSON null. A non-null object/array/string is accepted, but null is rejected because a null descriptor carries no protocol information and would produce an empty endpoint entry.","triggerScenarios":"User enters the literal text 'null' in the nativeDescriptor field, or a JSON whose intended descriptor field resolved to null.","commonSituations":"Default placeholder is 'null'. User clears the field and a default null is inserted. Misunderstanding that null means 'no descriptor'.","solutions":["Provide an actual descriptor object, e.g. {} or {\"openapi\":\"3.0.0\"}, not null.","If the descriptor is optional, leave the field empty rather than typing null.","Reject literal null client-side before submit."],"exampleFix":"// before\nnativeDescriptor = 'null'\n\n// after\nnativeDescriptor = '{\"openapi\":\"3.0.0\",\"paths\":{}}'","handlingStrategy":"validation","validationCode":"function checkDescriptor(parsed) { if (parsed === null) throw new Error('nativeDescriptor must not be null'); }","typeGuard":"function isNonNullJson(v: unknown): boolean { return v !== null; }","tryCatchPattern":"try { parseJson(descriptor, 'nativeDescriptor'); } catch (e) {\n  if (/must not be JSON null/.test(e.message)) { toast.error('Provide an actual descriptor object'); }\n}","preventionTips":["Default descriptor field to {}","Reject literal null client-side","Leave empty rather than null when optional"],"tags":["validation","descriptor","json","agent"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}