alibaba/nacos · error · NacosApiException

20012

20012

Error message

config gray rule version invalid

What it means

Error "config gray rule version invalid" thrown in alibaba/nacos.

Source

Thrown at config/src/main/java/com/alibaba/nacos/config/server/service/ConfigOperationService.java:202

     * @param configRequestInfo ConfigRequestInfo
     * @return boolean
     * @throws NacosException NacosException.
     * @date 2024/2/5
     */
    public Boolean publishConfigGray(String grayType, ConfigForm configForm,
        ConfigRequestInfo configRequestInfo)
        throws NacosException {
        configForm
            .setNamespaceId(NamespaceUtil.processNamespaceParameter(configForm.getNamespaceId()));
        
        Map<String, Object> configAdvanceInfo = getConfigAdvanceInfo(configForm);
        ParamUtils.checkParam(configAdvanceInfo);
        
        ConfigGrayPersistInfo localConfigGrayPersistInfo = new ConfigGrayPersistInfo(grayType,
            configForm.getGrayVersion(), configForm.getGrayRuleExp(), configForm.getGrayPriority());
        GrayRule grayRuleStruct = GrayRuleManager.constructGrayRule(localConfigGrayPersistInfo);
        if (grayRuleStruct == null) {
            throw new NacosApiException(HttpStatus.BAD_REQUEST.value(),
                ErrorCode.CONFIG_GRAY_VERSION_INVALID,
                ErrorCode.CONFIG_GRAY_VERSION_INVALID.getMsg());
        }
        
        if (!grayRuleStruct.isValid()) {
            throw new NacosApiException(HttpStatus.BAD_REQUEST.value(),
                ErrorCode.CONFIG_GRAY_RULE_FORMAT_INVALID,
                ErrorCode.CONFIG_GRAY_RULE_FORMAT_INVALID.getMsg());
        }
        
        //version count check.
        if (checkGrayVersionOverMaxCount(configForm.getDataId(), configForm.getGroup(),
            configForm.getNamespaceId(),
            configForm.getGrayName())) {
            throw new NacosApiException(HttpStatus.BAD_REQUEST.value(),
                ErrorCode.CONFIG_GRAY_OVER_MAX_VERSION_COUNT,
                "gray config version is over max count :" + getMaxGrayVersionCount());
        }

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Correct the invalid value for gray rule version to match the expected format or allowed set, then retry.

When it happens

Trigger: Thrown at config/src/main/java/com/alibaba/nacos/config/server/service/ConfigOperationService.java:202 when the library encounters an invalid state.

Common situations: Publishing a gray rule whose version does not match the current config version.


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