alibaba/nacos · warning · Error

${name} is required

Error message

${name} is required

What it means

Thrown by the agent-console-model required() helper when a value is null, undefined, empty, or whitespace-only after trimming. This is the shared guard for mandatory string fields across agent draft creation, A2A card projection, and call-interface serialization. The error embeds the field name (e.g. 'agentName', 'version', 'transport', 'AgentCard name').

Source

Thrown at console-ui/src/pages/AI/agent-console-model.js:56

export const DEFAULT_CALL_INTERFACES = JSON.stringify(
  [
    {
      protocol: 'custom',
      protocolVersion: '1.0.0',
      descriptorMediaType: 'application/json',
      nativeDescriptor: {},
      endpointSourceOrder: ['RUNTIME', 'DECLARED'],
      declaredEndpoints: [],
    },
  ],
  null,
  2
);

function required(value, name) {
  const result = String(value || '').trim();
  if (!result) {
    throw new Error(`${name} is required`);
  }
  return result;
}

function parseJson(value, name) {
  try {
    return JSON.parse(value);
  } catch (e) {
    throw new Error(`${name} must be valid JSON`);
  }
}

function parseAgentCardJson(value) {
  const withoutTrailingCommas = value.replace(
    /("(?:\\.|[^"\\])*")|,\s*([}\]])/g,
    (match, quoted, closing) => quoted || closing || match
  );
  return parseJson(withoutTrailingCommas, 'agentCard');

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Read the field name in the message and fill in that required field.
  2. For AgentCard projection, ensure the JSON includes non-empty 'name' and 'version' (or pass a fallback version).
  3. For transport, ensure a protocol binding like 'HTTP' or 'GRPC' is selected.

Example fix

// before
values.agentName = '';

// after
values.agentName = 'my-agent';
Defensive patterns

Strategy: validation

Validate before calling

function assertRequired(value, name) {
  const result = String(value || '').trim();
  if (!result) throw new Error(`${name} is required`);
  return result;
}

Type guard

function isNonEmptyString(v) {
  return typeof v === 'string' && v.trim().length > 0;
}

Try / catch

try {
  buildDraftCreateData(namespaceId, values, initial, contentMode, protocolEditors);
} catch (e) {
  Message.error(e.message); // e.g. 'agentName is required'
  return;
}

Prevention

When it happens

Trigger: Submitting an agent form with a blank required field: agentName, version, basedOnVersion, transport, AgentCard interface url, AgentCard interface protocolVersion, callInterfaces, or agentCard text.

Common situations: User leaves the agent name or version empty, pastes an AgentCard JSON missing the 'name' field, or a structured protocol editor with an empty transport.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/4ba93f7db2313704. Report an issue: GitHub.