{"record":{"id":"c24d8d96373cf5ea","repo":"alibaba/nacos","slug":"10000-c24d8d","errorCode":"10000","errorMessage":"Request parameter `agentSpecName` should not be blank.","messagePattern":"Request parameter `agentSpecName` should not be blank\\.","errorType":"validation","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"ai/src/main/java/com/alibaba/nacos/ai/form/agentspecs/admin/AgentSpecDraftCreateForm.java","lineNumber":44,"sourceCode":"/**\n * AgentSpec draft create form.\n *\n * @author nacos\n */\npublic class AgentSpecDraftCreateForm extends AgentSpecForm {\n    \n    @Serial\n    private static final long serialVersionUID = 1L;\n    \n    private String basedOnVersion;\n    \n    private String targetVersion;\n    \n    @Override\n    public void validate() throws NacosApiException {\n        fillDefaultNamespaceId();\n        if (StringUtils.isBlank(getAgentSpecName())) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"Request parameter `agentSpecName` should not be blank.\");\n        }\n    }\n    \n    public String getBasedOnVersion() {\n        return basedOnVersion;\n    }\n    \n    public void setBasedOnVersion(String basedOnVersion) {\n        this.basedOnVersion = basedOnVersion;\n    }\n    \n    public String getTargetVersion() {\n        return targetVersion;\n    }\n    \n    public void setTargetVersion(String targetVersion) {\n        this.targetVersion = targetVersion;","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/ai/src/main/java/com/alibaba/nacos/ai/form/agentspecs/admin/AgentSpecDraftCreateForm.java#L26-L62","documentation":"Thrown by the private AgentValidationUtils.validatePrintableAscii when a character falls outside 0x21-0x7E (i.e. any control char, space 0x20, DEL 0x7F, or non-ASCII). Unlike validateAgentName which allows spaces, this stricter range forbids spaces entirely. The dynamic fieldName and value are interpolated; currently only validateProtocolVersion routes through it with fieldName 'protocolVersion'.","triggerScenarios":"Supplying a protocolVersion containing a space, tab, control character, or non-ASCII char (validateProtocolVersion line 150 calls validatePrintableAscii(protocolVersion, \"protocolVersion\")). Any future caller of validatePrintableAscii would surface its fieldName here.","commonSituations":"A version string built by concatenation that introduced a space; tab/whitespace from copy-paste; a localized build label with non-ASCII characters.","solutions":["Ensure the value contains only printable ASCII 0x21-0x7E (no spaces) for protocolVersion.","Strip whitespace and control characters before submission.","Validate with the same character class the server uses to fail fast locally."],"exampleFix":"// before\nfilter.setProtocolVersion(\"1.2.0 rc\");\n// after\nfilter.setProtocolVersion(\"1.2.0-rc\");","handlingStrategy":"validation","validationCode":"if (value == null) {\n    throw new IllegalArgumentException(\"Invalid \" + fieldName + \": null\");\n}\nfor (int i = 0; i < value.length(); i++) {\n    char c = value.charAt(i);\n    if (c < 0x21 || c > 0x7E) {\n        throw new IllegalArgumentException(\"Invalid \" + fieldName + \": \" + value);\n    }\n}","typeGuard":"static boolean isPrintableAsciiNoSpace(String s) {\n    return s != null && s.chars().allMatch(c -> c >= 0x21 && c <= 0x7E);\n}","tryCatchPattern":"try {\n    AgentValidationUtils.validateProtocolVersion(protocolVersion);\n} catch (IllegalArgumentException e) {\n    // return 400, protocolVersion contains non-printable/space\n}","preventionTips":["Strip whitespace and control chars from version strings.","Build version strings from alnum and punctuation only."],"tags":["ai-agent","validation","protocol-version","ascii","illegal-argument"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}