alibaba/nacos · error · NacosApiException

PARAMETER_MISSING

PARAMETER_MISSING

Error message

Required parameter 'version' type String is not present

What it means

PromptPublishForm.validate() runs `super.validate()` (base prompt fields) then enforces that `version` is present before publishing a new prompt version. Publishing without a version is meaningless because the version is the storage/publishing key, so the server rejects with PARAMETER_MISSING before the format check (error 43) runs.

Source

Thrown at ai/src/main/java/com/alibaba/nacos/ai/form/prompt/PromptPublishForm.java:74

    
    /**
     * Prompt biz tags (comma-separated, optional).
     */
    private String bizTags;
    
    /**
     * Variable definitions with default values (JSON array string, optional).
     *
     * <p>Example: [{"name":"question","defaultValue":"Hello","description":"User question"}]</p>
     */
    private String variables;
    
    @Override
    public void validate() throws NacosApiException {
        super.validate();
        
        if (StringUtils.isEmpty(version)) {
            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,
                "Required parameter 'version' type String is not present");
        }
        
        if (!PromptVersionUtils.isValidVersion(version)) {
            throw new NacosApiException(NacosException.INVALID_PARAM,
                ErrorCode.PARAMETER_VALIDATE_ERROR,
                "Parameter 'version' must be in format 'major.minor.patch' (e.g., '1.0.0')");
        }
    }
    
    public String getVersion() {
        return version;
    }
    
    public void setVersion(String version) {
        this.version = version;
    }
    

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Add a semantic version string in `major.minor.patch` form, e.g. `1.0.0`.
  2. Check existing published versions and bump to a higher version (see PromptVersionUtils.isVersionGreater).
  3. Ensure the publish request body actually serializes the version field (not just sets it in a non-serialized transient field).

Example fix

// before
{"promptKey":"hello","template":"Hello {{name}}"}
// after
{"promptKey":"hello","version":"1.0.0","template":"Hello {{name}}"}
Defensive patterns

Strategy: validation

Validate before calling

// Before calling prompt publish
if (version == null || version.isEmpty()) {
    throw new IllegalArgumentException("version is required to publish a prompt");
}

Type guard

// TypeScript
const hasPublishVersion = (v?: string | null): boolean =>
  v != null && v.length > 0;

Try / catch

try {
    form.validate();
} catch (NacosApiException e) {
    // collect the version from the user and retry
}

Prevention

When it happens

Trigger: Calling the prompt publish API (POST /v3/admin/ai/prompts/publish) without a `version` field, or with version=null/empty. The check uses StringUtils.isEmpty so empty-string also fails.

Common situations: Assuming the server auto-increments version; frontend publishing form that never collected version; sending `template` and `commitMsg` but forgetting version; migrating from an API that inferred version from content hash.

Related errors


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