{"record":{"id":"3c385ce4428b7233","repo":"alibaba/nacos","slug":"invalid-param-3c385c","errorCode":"INVALID_PARAM","errorMessage":"parameters `promptKey` can't be empty or null","messagePattern":"parameters `promptKey` can't be empty or null","errorType":"validation","errorClass":"NacosApiException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/com/alibaba/nacos/client/ai/NacosAiService.java","lineNumber":602,"sourceCode":"        return getPromptByVersion(promptKey, null);\n    }\n    \n    @Override\n    public Prompt getPromptByVersion(String promptKey, String version) throws NacosException {\n        if (StringUtils.isBlank(promptKey)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"parameters `promptKey` can't be empty or null\");\n        }\n        if (StringUtils.isBlank(version)) {\n            return aiClientProxy.queryPrompt(promptKey, null, null, null);\n        }\n        return aiClientProxy.queryPrompt(promptKey, version, null, null);\n    }\n    \n    @Override\n    public Prompt getPromptByLabel(String promptKey, String label) throws NacosException {\n        if (StringUtils.isBlank(promptKey)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"parameters `promptKey` can't be empty or null\");\n        }\n        if (StringUtils.isBlank(label)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"parameters `label` can't be empty or null\");\n        }\n        return aiClientProxy.queryPrompt(promptKey, null, label, null);\n    }\n    \n    @Override\n    public Prompt subscribePrompt(String promptKey, String version, String label,\n        AbstractNacosPromptListener promptListener) throws NacosException {\n        if (StringUtils.isBlank(promptKey)) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,\n                \"parameters `promptKey` can't be empty or null\");\n        }\n        if (null == promptListener) {\n            throw new NacosApiException(NacosException.INVALID_PARAM, ErrorCode.PARAMETER_MISSING,","sourceCodeStart":584,"sourceCodeEnd":620,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client/src/main/java/com/alibaba/nacos/client/ai/NacosAiService.java#L584-L620","documentation":"Thrown by getPromptByLabel(String, String) when promptKey is blank. The key is validated first; if non-blank, the label is then checked. This method requires BOTH a key and a non-blank label (unlike getPromptByVersion which tolerates a blank version).","triggerScenarios":"Calling aiService.getPromptByLabel(\"\", \"stable\") or getPromptByLabel(null, label). The label is not yet validated when this fires.","commonSituations":"Label-driven lookup where the key comes from one config source and the label from another, and the key source is empty; mixing up argument order and passing the label first.","solutions":["Pass a non-blank promptKey as the first argument (verify you have not swapped key and label).","Validate both key and label at the call site, since this method requires both.","If the label is optional for your flow, use getPrompt(key) or getPromptByVersion instead."],"exampleFix":"// before\nPrompt p = aiService.getPromptByLabel(label, key); // swapped args -> key blank -> throws\n\n// after\nPrompt p = aiService.getPromptByLabel(key, label); // correct order","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(promptKey)) {\n    throw new IllegalArgumentException(\"promptKey required\");\n}\nPrompt p = aiService.getPromptByLabel(promptKey, label);","typeGuard":"static boolean canGetByLabel(String key, String label) {\n    return StringUtils.isNotBlank(key) && StringUtils.isNotBlank(label);\n}","tryCatchPattern":null,"preventionTips":["Double-check argument order: key first, label second.","Use getPrompt(key) if the label is optional for your flow."],"tags":["ai-registry","prompt","parameter-validation","client"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}