alibaba/nacos · error · NacosApiException

10000

10000

Error message

Request parameter `agentSpecName` should not be blank.

What it means

Thrown by RadModelValidator.validateAbsoluteUri when a URI field (e.g. provider.url) is syntactically invalid (java.net.URISyntaxException). It first length-checks (1-2048), attempts new URI(value), and on a syntax failure wraps the cause with 'Invalid <fieldName>: <value>'. A separate message covers the 'must be an absolute URI' (parses but not absolute) case.

Source

Thrown at ai/src/main/java/com/alibaba/nacos/ai/form/agentspecs/admin/AgentSpecOnlineForm.java:50

    
    @Serial
    private static final long serialVersionUID = 1L;
    
    /**
     * "agentspec" means enable/disable the whole agentspec. Otherwise version-level.
     */
    private String scope;
    
    /**
     * Version for version-level online/offline.
     */
    private String version;
    
    @Override
    public void validate() throws NacosApiException {
        fillDefaultNamespaceId();
        if (StringUtils.isBlank(getAgentSpecName())) {
            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,
                "Request parameter `agentSpecName` should not be blank.");
        }
    }
    
    public String getScope() {
        return scope;
    }
    
    public void setScope(String scope) {
        this.scope = scope;
    }
    
    @Override
    public String getVersion() {
        return version;
    }
    
    @Override

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Percent-encode the URL and ensure it has an explicit scheme (e.g. https://).
  2. Validate with new URI(value) and isAbsolute() client-side before submission.
  3. Build URLs with a URI builder rather than string concatenation.

Example fix

// before
provider.setUrl("https://ex ample.com/desc");
// after
provider.setUrl("https://example.com/desc");
Defensive patterns

Strategy: validation

Validate before calling

if (value == null || value.length() > 2048) {
    throw new IllegalArgumentException("Invalid " + fieldName + ": " + value);
}
try {
    if (!new URI(value).isAbsolute()) {
        throw new IllegalArgumentException(fieldName + " must be an absolute URI");
    }
} catch (URISyntaxException e) {
    throw new IllegalArgumentException("Invalid " + fieldName + ": " + value, e);
}

Type guard

static boolean isAbsoluteUri(String s) {
    if (s == null || s.length() > 2048) return false;
    try { return new URI(s).isAbsolute(); } catch (URISyntaxException e) { return false; }
}

Try / catch

try {
    RadModelValidator.validate(request);
} catch (IllegalArgumentException e) {
    // return 400, malformed provider.url
}

Prevention

When it happens

Trigger: Registering an AgentProvider whose url is malformed (unencoded spaces, stray characters, missing scheme) — RadModelValidator.validateProvider (line 523) calls validateAbsoluteUri(value, "provider.url").

Common situations: URLs pasted with spaces or unicode not percent-encoded; missing scheme ('example.com/x' instead of 'https://example.com/x'); trailing punctuation copied from docs; a URL built by string concatenation that omitted encoding.

Related errors


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