alibaba/nacos · error · Error

${name} is required

Error message

${name} is required

What it means

Generic required-field validator in the new-agent console model. It trims the input and throws if the result is empty. It is reused by many callers with a `name` argument, so the message is parameterized (e.g. 'agentName is required', 'transport is required', 'version is required').

Source

Thrown at console-ui-next/src/pages/newAgent/agent-console-model.ts:106

  status: 'enable' | 'disable';
  protocolEditorKind: ProtocolEditorKind;
  agentCard: string;
  customProtocol: string;
  customProtocolVersion: string;
  customDescriptorMediaType: string;
  customNativeDescriptor: string;
  endpointSourceMode: EndpointSourceMode;
  declaredEndpoints: DeclaredEndpointEditorValue[];
  callInterfaces: string;
  basedOnVersion: string;
  author: string;
  changeDescription: string;
}

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

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

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

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Identify which field is named in the message and provide a non-empty value.
  2. Add client-side required-field indicators so the user sees the gap before submit.
  3. Strip stray whitespace on blur to avoid whitespace-only submissions.

Example fix

// before
values.agentName = '   ';

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

Strategy: validation

Validate before calling

function ensureRequired(value, name) {
  if (!value || !value.trim()) { throw new Error(`${name} is required`); }
  return value.trim();
}

Type guard

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

Try / catch

try { serializeCallInterfaces(values); } catch (e) {
  if (/is required/.test(e.message)) { markFieldError(e.message); }
}

Prevention

When it happens

Trigger: The user submits the new-agent form with a required text field left blank or containing only whitespace. Called for agentName, version, transport, Endpoint uri, nativeDescriptor, descriptorMediaType, agentCard, callInterfaces, and providerName.

Common situations: Submitting a draft before filling required fields. A field auto-filled from a disabled control that returned empty. Whitespace-only input from copy-paste.

Related errors


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