alibaba/nacos · error · NacosApiException
20002
20002
Error message
Request parameter `autoSubmit` must be `true` or `false`.
What it means
Thrown by AgentValidationUtils.validateEndpointMetadata when the Endpoint metadata map has more than 32 entries (MAX_METADATA_SIZE). The cap is on entry count, before per-key/per-value checks run. Metadata is optional (null returns cleanly), but a non-null map is size-bounded.
Source
Thrown at ai/src/main/java/com/alibaba/nacos/ai/form/agent/client/AgentPublishForm.java:89
return result;
}
public String getAutoSubmit() {
return autoSubmit;
}
public void setAutoSubmit(String autoSubmit) {
this.autoSubmit = autoSubmit;
}
private boolean parseAutoSubmit() throws NacosApiException {
if (Boolean.TRUE.toString().equalsIgnoreCase(autoSubmit)) {
return true;
}
if (Boolean.FALSE.toString().equalsIgnoreCase(autoSubmit)) {
return false;
}
throw new NacosApiException(NacosException.INVALID_PARAM,
ErrorCode.PARAMETER_VALIDATE_ERROR,
"Request parameter `autoSubmit` must be `true` or `false`.");
}
}
View on GitHub (pinned to 9b989acdf1)
Solutions
- Keep Endpoint metadata to <=32 entries; select only the labels relevant to routing.
- Drop internal/system labels before submitting (they may also collide with reserved keys).
- If you need more, move bulk data out of metadata into your descriptor payload.
Example fix
// before
endpoint.setMetadata(allPodLabels); // 40 entries
// after
Map<String,String> picked = new LinkedHashMap<>();
allPodLabels.entrySet().stream().filter(e -> e.getKey().startsWith("app.")).limit(32).forEach(e -> picked.put(e.getKey(), e.getValue()));
endpoint.setMetadata(picked); Defensive patterns
Strategy: validation
Validate before calling
if (metadata != null && metadata.size() > 32) {
throw new IllegalArgumentException("Endpoint metadata exceeds 32 entries");
} Type guard
static boolean metadataWithinSize(Map<String,String> m) {
return m == null || m.size() <= 32;
} Try / catch
try {
AgentValidationUtils.validateEndpointMetadata(metadata);
} catch (IllegalArgumentException e) {
// return 400, metadata too large
} Prevention
- Select only routing-relevant labels for Endpoint metadata.
- Avoid dumping all pod labels/annotations into metadata.
When it happens
Trigger: Registering/canonicalizing an Endpoint whose metadata map has 33+ entries. Callers: EndpointCanonicalizer.canonicalize (line 77 via validateEndpointMetadata), AgentRuntimeEndpointMapper (line 345), RadModelValidator.validateResolveFilter (line 234, metadataSelector).
Common situations: Copying the full Kubernetes pod labels/annotations (often >32) into Endpoint metadata; propagating all tracing labels; a bug that duplicates keys across merges raising effective count.
Related errors
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/ca591b7f43cf2cee.
Report an issue: GitHub.