alibaba/nacos · error · NacosApiException

10000

10000

Error message

Required parameter 'agentSpecName' type String is not present

What it means

Thrown by EndpointCanonicalizer.canonicalize when its endpoint argument is null. canonicalize produces a canonical copy (URI parsed, transport validated, priority/weight defaulted, metadata sorted) and requires a non-null Endpoint to begin. This is a programmer/contract error, not a data-format error.

Source

Thrown at ai/src/main/java/com/alibaba/nacos/ai/form/agentspecs/admin/AgentSpecForm.java:48

 *
 * @author nacos
 */
public class AgentSpecForm implements NacosForm {
    
    @Serial
    private static final long serialVersionUID = 1L;
    
    private String namespaceId;
    
    private String agentSpecName;
    
    private String version;
    
    @Override
    public void validate() throws NacosApiException {
        fillDefaultNamespaceId();
        if (StringUtils.isEmpty(agentSpecName)) {
            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,
                "Required parameter 'agentSpecName' type String is not present");
        }
    }
    
    protected void fillDefaultNamespaceId() {
        if (StringUtils.isEmpty(namespaceId)) {
            namespaceId = Constants.AgentSpecs.AGENTSPEC_DEFAULT_NAMESPACE;
        }
    }
    
    public String getNamespaceId() {
        return namespaceId;
    }
    
    public void setNamespaceId(String namespaceId) {
        this.namespaceId = namespaceId;
    }
    

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Null-check (or filter non-null) before calling canonicalize.
  2. Reject null Endpoints at the deserialization/form-validation boundary.
  3. If null is meaningful in your flow, skip canonicalization for that element rather than passing null.

Example fix

// before
Endpoint canon = EndpointCanonicalizer.canonicalize(endpoint);
// after
if (endpoint == null) {
    throw new IllegalArgumentException("endpoint is required");
}
Endpoint canon = EndpointCanonicalizer.canonicalize(endpoint);
Defensive patterns

Strategy: type-guard

Validate before calling

if (endpoint == null) {
    throw new IllegalArgumentException("Endpoint must not be null");
}
EndpointCanonicalizer.canonicalize(endpoint);

Type guard

static boolean isCanonicalizable(Endpoint e) {
    return e != null;
}

Try / catch

try {
    Endpoint canon = EndpointCanonicalizer.canonicalize(endpoint);
} catch (IllegalArgumentException e) {
    // return 400 / skip null endpoint
}

Prevention

When it happens

Trigger: Calling EndpointCanonicalizer.canonicalize(null) directly, or passing a list/stream that contains a null Endpoint which is then canonicalized element-wise.

Common situations: A collection containing null endpoints due to a partial deserialization; defensive code that calls canonicalize on a possibly-null reference without a prior null check; stream pipelines that forget filter(Objects::nonNull).

Related errors


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