{"record":{"id":"7018ebd1240f3919","repo":"paascloud/paascloud-master","slug":"error-7018eb","errorCode":null,"errorMessage":"获取验证码的值失败","messagePattern":"获取验证码的值失败","errorType":"validation","errorClass":"ValidateCodeException","httpStatus":400,"severity":"error","filePath":"paascloud-common/paascloud-security-core/src/main/java/com/paascloud/security/core/validate/code/impl/AbstractValidateCodeProcessor.java","lineNumber":137,"sourceCode":"\t}\n\n\t/**\n\t * Check.\n\t *\n\t * @param request the request\n\t */\n\t@SuppressWarnings(\"unchecked\")\n\t@Override\n\tpublic void check(ServletWebRequest request) {\n\t\tValidateCodeType codeType = getValidateCodeType();\n\n\t\tC codeInSession = (C) validateCodeRepository.get(request, codeType);\n\n\t\tString codeInRequest;\n\t\ttry {\n\t\t\tcodeInRequest = ServletRequestUtils.getStringParameter(request.getRequest(), codeType.getParamNameOnValidate());\n\t\t} catch (ServletRequestBindingException e) {\n\t\t\tthrow new ValidateCodeException(\"获取验证码的值失败\");\n\t\t}\n\n\t\tif (StringUtils.isBlank(codeInRequest)) {\n\t\t\tthrow new ValidateCodeException(codeType + \"验证码的值不能为空\");\n\t\t}\n\n\t\tif (codeInSession == null || codeInSession.isExpired()) {\n\t\t\tvalidateCodeRepository.remove(request, codeType);\n\t\t\tthrow new ValidateCodeException(codeType + \"验证码已过期\");\n\t\t}\n\n\t\tif (!StringUtils.equals(codeInSession.getCode(), codeInRequest)) {\n\t\t\tthrow new ValidateCodeException(codeType + \"验证码不匹配\");\n\t\t}\n\t}\n}\n","sourceCodeStart":119,"sourceCodeEnd":154,"githubUrl":"https://github.com/paascloud/paascloud-master/blob/781281a9503332ed3cef44ea618349d14230a127/paascloud-common/paascloud-security-core/src/main/java/com/paascloud/security/core/validate/code/impl/AbstractValidateCodeProcessor.java#L119-L154","documentation":"AbstractValidateCodeProcessor.check reads the expected code parameter from the HTTP request using ServletRequestUtils.getStringParameter. If the parameter is entirely absent (ServletRequestBindingException), a ValidateCodeException '获取验证码的值失败' is thrown.","triggerScenarios":"Submitting a login/form request without the validate-code parameter named by codeType.getParamNameOnValidate() (e.g. no 'smsCode' or 'imageCode' request parameter).","commonSituations":"Frontend form field name doesn't match the configured param name; request sent as JSON body while the filter reads query/form parameters; validate-code step skipped or parameter dropped by a proxy/gateway.","solutions":["Send the parameter named exactly like codeType.getParamNameOnValidate() (e.g. smsCode) as a form field or query param","Fix the frontend form field name to match the configured ValidateCodeProperties","If submitting JSON, ensure it is converted to form/query parameters before the filter runs","Check gateways/filters are not stripping the parameter"],"exampleFix":"// before\nPOST /auth/form  body: username=a&password=b   (missing smsCode)\n// after\nPOST /auth/form  body: username=a&password=b&smsCode=123456","handlingStrategy":"validation","validationCode":"if (request.getParameter(\"smsCode\") == null) { throw new IllegalArgumentException(\"缺少验证码参数\"); }","typeGuard":null,"tryCatchPattern":"try { processor.validate(new ServletWebRequest(request)); } catch (ValidateCodeException e) { return errorResponse(e.getMessage()); }","preventionTips":["Match frontend field names to getParamNameOnValidate()","Send codes as form/query params, not JSON bodies, unless the filter parses JSON","Integration-test the full login form flow"],"tags":["validation-code","http-request","missing-parameter"],"backgroundTag":"missing-required-argument","analyzedSha":"781281a9503332ed3cef44ea618349d14230a127","analyzedAt":"2026-09-10T10:59:02.070Z","contentChangedAt":"2026-09-10T10:59:02.070Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}