{"record":{"id":"6385fdd5daa17ec7","repo":"alibaba/nacos","slug":"parameter-validate-error-6385fd","errorCode":"PARAMETER_VALIDATE_ERROR","errorMessage":"Parameter 'scope' must be PUBLIC or PRIVATE","messagePattern":"Parameter 'scope' must be PUBLIC or PRIVATE","errorType":"exception","errorClass":"NacosApiException","httpStatus":400,"severity":"warning","filePath":"ai/src/main/java/com/alibaba/nacos/ai/form/skills/admin/SkillScopeForm.java","lineNumber":48,"sourceCode":" * @author nacos\n */\npublic class SkillScopeForm extends SkillForm {\n    \n    @Serial\n    private static final long serialVersionUID = 1L;\n    \n    private String scope;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        super.validate();\n        if (StringUtils.isBlank(scope)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'scope' type String is not present\");\n        }\n        if (!VisibilityConstants.SCOPE_PUBLIC.equalsIgnoreCase(scope)\n            && !VisibilityConstants.SCOPE_PRIVATE.equalsIgnoreCase(scope)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM,\n                ErrorCode.PARAMETER_VALIDATE_ERROR,\n                \"Parameter 'scope' must be PUBLIC or PRIVATE\");\n        }\n    }\n    \n    public String getScope() {\n        return scope;\n    }\n    \n    public void setScope(String scope) {\n        this.scope = scope;\n    }\n}\n","sourceCodeStart":30,"sourceCodeEnd":62,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/skills/admin/SkillScopeForm.java#L30-L62","documentation":"SkillScopeForm.validate() enforces that `scope` be one of the two allowed visibility values: PUBLIC or PRIVATE (VisibilityConstants, compared case-insensitively). Anything else is an undefined visibility level and is rejected with PARAMETER_VALIDATE_ERROR after the presence check (error 57) passes.","triggerScenarios":"Calling the skill scope API with scope set to a value other than PUBLIC/PRIVATE — e.g. `scope=public_only`, `scope=shared`, `scope=organization`, `scope=internal`. Case does not matter (PUBLIC, public, Public all accepted).","commonSituations":"Using organizational terminology like \"internal\"/\"shared\"; lowercase variants are fine but invented values are not; confusion with other systems' visibility enums.","solutions":["Set `scope=PUBLIC` (visible to other namespaces/tenants) or `scope=PRIVATE` (owner only). Case-insensitive.","Map your internal terminology to one of these two values before sending.","Do not invent intermediate visibility levels — the API has exactly two."],"exampleFix":"// before\n{\"skillName\":\"my-skill\",\"scope\":\"internal\"}\n// after\n{\"skillName\":\"my-skill\",\"scope\":\"PRIVATE\"}","handlingStrategy":"validation","validationCode":"// Before calling skill scope change\nif (!\"PUBLIC\".equalsIgnoreCase(scope) && !\"PRIVATE\".equalsIgnoreCase(scope)) {\n    throw new IllegalArgumentException(\"scope must be PUBLIC or PRIVATE\");\n}","typeGuard":"// TypeScript\ntype SkillScope = 'PUBLIC' | 'PRIVATE';\nconst isSkillScope = (s: string): s is SkillScope =>\n  ['PUBLIC','PRIVATE'].includes(s.toUpperCase());","tryCatchPattern":"try {\n    form.validate();\n} catch (NacosApiException e) {\n    // invalid scope — coerce to PUBLIC/PRIVATE and retry\n}","preventionTips":["Restrict the scope UI to a two-option toggle (PUBLIC/PRIVATE).","Do not invent intermediate visibility levels.","Map internal labels (e.g. 'internal') to PRIVATE before sending."],"tags":["validation","skill-api","scope","visibility","parameter-validation"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}