{"record":{"id":"3f8bc621bdb5590f","repo":"alibaba/nacos","slug":"invalid-endpoint-uri-uri","errorCode":null,"errorMessage":"Invalid Endpoint URI: ${uri}","messagePattern":"Invalid Endpoint URI: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"console-ui/src/pages/AI/agent-console-model.js","lineNumber":98,"sourceCode":"\nfunction optionalString(value) {\n  return typeof value === 'string' && value.trim() ? value.trim() : undefined;\n}\n\nfunction validateTransport(value) {\n  const transport = required(value, 'transport');\n  if (!/^[0-9A-Za-z+-]{1,64}$/.test(transport)) {\n    throw new Error('transport must contain 1 to 64 letters, digits, +, or -');\n  }\n  return transport;\n}\n\nfunction endpointKey(uri, transport) {\n  let parsed;\n  try {\n    parsed = new URL(uri);\n  } catch (e) {\n    throw new Error(`Invalid Endpoint URI: ${uri}`);\n  }\n  if (!parsed.protocol || !parsed.hostname || parsed.username || parsed.password || parsed.hash) {\n    throw new Error(`Invalid Endpoint URI: ${uri}`);\n  }\n  let { port } = parsed;\n  if (!port) {\n    if (parsed.protocol === 'http:' || parsed.protocol === 'ws:') {\n      port = '80';\n    } else if (parsed.protocol === 'https:' || parsed.protocol === 'wss:') {\n      port = '443';\n    } else {\n      throw new Error(`Invalid Endpoint URI: ${uri}`);\n    }\n  }\n  return `${parsed.hostname.toLowerCase()}@@${port}@@${transport}`;\n}\n\nfunction sourceOrder(mode) {","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console-ui/src/pages/AI/agent-console-model.js#L80-L116","documentation":"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.","triggerScenarios":"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.","commonSituations":"User pastes a path instead of a full URL, omits the scheme, or includes a typo that breaks URL parsing.","solutions":["Provide a fully-qualified URL with an explicit scheme, e.g. https://agent.example.com/a2a.","Remove leading slashes-only values; always include protocol + host.","Test the URI with `new URL(uri)` in a browser console before submitting."],"exampleFix":"// before\nuri = '/a2a';\n\n// after\nuri = 'https://agent.example.com/a2a';","handlingStrategy":"validation","validationCode":"function isParsableUrl(uri) {\n  try { new URL(uri); return true; } catch { return false; }\n}","typeGuard":"function isParsableUrl(uri) {\n  try { new URL(uri); return true; } catch { return false; }\n}","tryCatchPattern":"try {\n  endpointKey(uri, transport);\n} catch (e) {\n  Message.error(e.message); // 'Invalid Endpoint URI: ...'\n  return;\n}","preventionTips":["Require a full URL (scheme + host) in the endpoint input.","Validate the URI on blur with `new URL(uri)`.","Provide placeholder text showing the expected format."],"tags":["validation","agent","endpoint","uri","frontend"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}