{"record":{"id":"31def17b4a7e1d95","repo":"alibaba/nacos","slug":"parameter-missing-31def1","errorCode":"PARAMETER_MISSING","errorMessage":"Required parameter `skillCard.${fieldName}` not present","messagePattern":"Required parameter `skillCard\\.(.+?)` not present","errorType":"validation","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/utils/SkillRequestUtil.java","lineNumber":302,"sourceCode":"                String key = line.substring(0, colonIdx).trim();\n                if (field.equals(key)) {\n                    String value = line.substring(colonIdx + 1).trim();\n                    // Strip surrounding quotes\n                    if (value.length() >= 2 && ((value.startsWith(\"\\\"\") && value.endsWith(\"\\\"\"))\n                        || (value.startsWith(\"'\") && value.endsWith(\"'\")))) {\n                        value = value.substring(1, value.length() - 1);\n                    }\n                    return value;\n                }\n            }\n        }\n        return null;\n    }\n    \n    private static void validateSkillField(String fieldName, String fieldValue)\n        throws NacosApiException {\n        if (StringUtils.isEmpty(fieldValue)) {\n            throw new NacosApiException(NacosApiException.INVALID_PARAM,\n                ErrorCode.PARAMETER_MISSING,\n                \"Required parameter `skillCard.\" + fieldName + \"` not present\");\n        }\n    }\n    \n    /**\n     * Validate markdown content is present and has non-empty body after removing frontmatter.\n     *\n     * @param fieldPath field path used in error message\n     * @param markdown markdown content to validate\n     * @throws NacosApiException if markdown is missing or body is empty\n     */\n    public static void validateSkillMarkdownBody(String fieldPath, String markdown)\n        throws NacosApiException {\n        if (StringUtils.isEmpty(markdown)) {\n            throw new NacosApiException(NacosApiException.INVALID_PARAM,\n                ErrorCode.PARAMETER_MISSING,\n                \"Required parameter `\" + fieldPath + \"` not present\");","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/utils/SkillRequestUtil.java#L284-L320","documentation":"Thrown by validateSkillField when a required field on the parsed Skill object is null or empty. Called from validateSkill which checks name, description, and skillMd in sequence. The error message names the specific missing field via the fieldName parameter so the caller knows exactly which skillCard property is absent.","triggerScenarios":"POST/PUT to a skill endpoint where the skillCard JSON deserializes successfully but one of the required fields — name, description, or skillMd — is null, empty string, or omitted from the JSON object. The first missing field encountered causes the throw.","commonSituations":"Developer includes name and description but forgets skillMd; a field is present but set to empty string \"\"; the frontend form has a bug that strips a field before submission; a default Skill template is used that has placeholder nulls.","solutions":["Ensure skillCard JSON includes non-empty values for name, description, and skillMd.","Validate the JSON object client-side before submission: check each required key exists and has a non-blank string value.","If updating an existing skill, fetch the current skillCard first and merge changed fields rather than submitting a partial object.","Review the API spec for the full list of required fields on the Skill type."],"exampleFix":"// before — skillCard missing skillMd field\n{\"name\":\"my-skill\",\"description\":\"A test skill\"}\n\n// after — all required fields present\n{\"name\":\"my-skill\",\"description\":\"A test skill\",\"skillMd\":\"---\\nname: my-skill\\n---\\n# Instructions\\nDo the thing.\"}","handlingStrategy":"validation","validationCode":"// Ensure all required Skill fields are non-blank before submitting\nSkill skill = JacksonUtils.toObj(skillCardJson, Skill.class);\nif (StringUtils.isBlank(skill.getName())) throw new IllegalArgumentException(\"name is required\");\nif (StringUtils.isBlank(skill.getDescription())) throw new IllegalArgumentException(\"description is required\");\nif (StringUtils.isBlank(skill.getSkillMd())) throw new IllegalArgumentException(\"skillMd is required\");","typeGuard":"public static boolean hasRequiredSkillFields(Skill skill) {\n    return skill != null\n        && StringUtils.isNotBlank(skill.getName())\n        && StringUtils.isNotBlank(skill.getDescription())\n        && StringUtils.isNotBlank(skill.getSkillMd());\n}","tryCatchPattern":"try {\n    SkillRequestUtil.validateSkill(skill);\n} catch (NacosApiException e) {\n    if (ErrorCode.PARAMETER_MISSING.equals(e.getErrDetail())) {\n        // Extract field name from message and surface to UI\n        String field = extractFieldNameFromMessage(e.getErrMsg());\n        return \"Missing required field: \" + field;\n    }\n    throw e;\n}","preventionTips":["Define required-field checks in the frontend form before submission.","Use a Skill DTO/builder that enforces non-null for required fields at construction time.","Document the required skillCard fields in your API client docs."],"tags":["skill","parameter-missing","validation","skillcard"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}