alibaba/nacos · error · IllegalArgumentException

Invalid descriptorMediaType: {mediaType}

Error message

Invalid descriptorMediaType: {mediaType}

What it means

Error "Invalid descriptorMediaType: {mediaType}" thrown in alibaba/nacos.

Source

Thrown at api/src/main/java/com/alibaba/nacos/api/ai/utils/AgentValidationUtils.java:213

     * @param contentDigest content digest
     * @throws IllegalArgumentException when invalid
     */
    public static void validateContentDigest(String contentDigest) {
        if (contentDigest == null || !CONTENT_DIGEST_PATTERN.matcher(contentDigest).matches()) {
            throw new IllegalArgumentException("Invalid contentDigest: " + contentDigest);
        }
    }
    
    /**
     * Validate a descriptor media type.
     *
     * @param mediaType media type
     * @throws IllegalArgumentException when invalid
     */
    public static void validateMediaType(String mediaType) {
        if (mediaType == null || mediaType.length() > MAX_MEDIA_TYPE_LENGTH
            || !MEDIA_TYPE_PATTERN.matcher(mediaType).matches()) {
            throw new IllegalArgumentException("Invalid descriptorMediaType: " + mediaType);
        }
    }
    
    /**
     * Validate a required JSON-compatible value after request binding.
     *
     * @param value JSON-compatible value
     * @param fieldName field name used in validation errors
     * @throws IllegalArgumentException when the value is {@code null}
     */
    public static void validateNonNullJsonValue(Object value, String fieldName) {
        if (value == null) {
            throw new IllegalArgumentException(fieldName + " must not be JSON null");
        }
    }
    
    /**
     * Validate optional public Endpoint metadata.

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Correct the invalid value for descriptorMediaType validation to match the expected format or allowed set, then retry.

When it happens

Trigger: Thrown at api/src/main/java/com/alibaba/nacos/api/ai/utils/AgentValidationUtils.java:213 when the library encounters an invalid state.

Common situations: Validating a storage descriptor with an unsupported media type.


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