alibaba/nacos · warning · Error

Invalid Endpoint URI: ${uri}

Error message

Invalid Endpoint URI: ${uri}

What it means

Thrown by endpointKey() in agent-console-model when the endpoint URI cannot be parsed by the URL constructor at all (new URL(uri) throws). This is the first of three URI checks: it fires when the string is not a syntactically valid absolute URL.

Source

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

function optionalString(value) {
  return typeof value === 'string' && value.trim() ? value.trim() : undefined;
}

function validateTransport(value) {
  const transport = required(value, 'transport');
  if (!/^[0-9A-Za-z+-]{1,64}$/.test(transport)) {
    throw new Error('transport must contain 1 to 64 letters, digits, +, or -');
  }
  return transport;
}

function endpointKey(uri, transport) {
  let parsed;
  try {
    parsed = new URL(uri);
  } catch (e) {
    throw new Error(`Invalid Endpoint URI: ${uri}`);
  }
  if (!parsed.protocol || !parsed.hostname || parsed.username || parsed.password || parsed.hash) {
    throw new Error(`Invalid Endpoint URI: ${uri}`);
  }
  let { port } = parsed;
  if (!port) {
    if (parsed.protocol === 'http:' || parsed.protocol === 'ws:') {
      port = '80';
    } else if (parsed.protocol === 'https:' || parsed.protocol === 'wss:') {
      port = '443';
    } else {
      throw new Error(`Invalid Endpoint URI: ${uri}`);
    }
  }
  return `${parsed.hostname.toLowerCase()}@@${port}@@${transport}`;
}

function sourceOrder(mode) {

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Provide a fully-qualified URL with an explicit scheme, e.g. https://agent.example.com/a2a.
  2. Remove leading slashes-only values; always include protocol + host.
  3. Test the URI with `new URL(uri)` in a browser console before submitting.

Example fix

// before
uri = '/a2a';

// after
uri = 'https://agent.example.com/a2a';
Defensive patterns

Strategy: validation

Validate before calling

function isParsableUrl(uri) {
  try { new URL(uri); return true; } catch { return false; }
}

Type guard

function isParsableUrl(uri) {
  try { new URL(uri); return true; } catch { return false; }
}

Try / catch

try {
  endpointKey(uri, transport);
} catch (e) {
  Message.error(e.message); // 'Invalid Endpoint URI: ...'
  return;
}

Prevention

When it happens

Trigger: Entering a relative path like '/a2a', a bare hostname like 'agent.example.com', or a string with invalid URL syntax (e.g. 'ht!tp://x') as an endpoint URI.

Common situations: User pastes a path instead of a full URL, omits the scheme, or includes a typo that breaks URL parsing.

Related errors


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