{"record":{"id":"02b7d3f4f7a1788c","repo":"alibaba/spring-ai-alibaba","slug":"s-s-02b7d3","errorCode":null,"errorMessage":"参数 %s 的值 '%s' 应该是数值类型","messagePattern":"参数 (.+?) 的值 '(.+?)' 应该是数值类型","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/utils/ModelConfigParser.java","lineNumber":258,"sourceCode":"     * @param parameterName 参数名\n     * @param value         参数值\n     */\n    private void validateNumericValue(String parameterName, Object value) {\n        if (value instanceof Number) {\n            return; // 已经是数值类型\n        }\n        \n        if (value instanceof String) {\n            try {\n                Double.parseDouble((String) value);\n                return; // 可以转换为数值\n            } catch (NumberFormatException e) {\n                throw new IllegalArgumentException(\n                        String.format(\"参数 %s 的值 '%s' 不是有效的数值\", parameterName, value));\n            }\n        }\n        \n        throw new IllegalArgumentException(String.format(\"参数 %s 的值 '%s' 应该是数值类型\", parameterName, value));\n    }\n}\n","sourceCodeStart":240,"sourceCodeEnd":261,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/utils/ModelConfigParser.java#L240-L261","documentation":"ModelConfigParser.validateNumericValue throws this IllegalArgumentException when a model config parameter that must be numeric has a value that cannot be parsed as a number (the NumberFormatException branch rethrows a variant message, and any remaining non-numeric value reaches the final throw). It guards DashScope/studio model configuration parsing so numeric fields like temperature or max tokens are valid numbers.","triggerScenarios":"Calling validateNumericValue (indirectly via validateParameterTypes during model config parsing) with a parameter value like \"hot\", \"\", or \"1.2.3\" that fails numeric parsing or is not numeric at all.","commonSituations":"Typing a non-numeric value into a studio admin model config field, pasting config with locale-formatted numbers (e.g. \"0,7\"), or whitespace/unit suffixes like \"1024 tokens\".","solutions":["Set the parameter value to a valid number string (e.g. \"0.7\", \"1024\") in the model config.","Strip units, whitespace, and locale separators (use '.' as decimal point) from the value.","If the field should not be numeric, change the parameter name/type in the config schema instead of forcing it through numeric validation.","Catch IllegalArgumentException around ModelConfigParser calls to surface a user-friendly message naming the offending parameter."],"exampleFix":"// before\nproperties.put(\"temperature\", \"0,7\");\n// after\nproperties.put(\"temperature\", \"0.7\");","handlingStrategy":"validation","validationCode":"static boolean isNumeric(String v) { try { Double.parseDouble(v == null ? \"\" : v.trim()); return true; } catch (NumberFormatException e) { return false; } }\n// call before parser: if (!isNumeric(raw)) throw new IllegalArgumentException(\"Value must be numeric: \" + raw);","typeGuard":null,"tryCatchPattern":"try { parser.validateParameterTypes(config); } catch (IllegalArgumentException e) { log.error(\"Bad model config: {}\", e.getMessage()); }\n// or as NumberFormatException is the root cause:\ntry { Double.parseDouble(value); } catch (NumberFormatException e) { /* prompt user for a numeric value */ }","preventionTips":["Always store numeric config as plain dot-decimal strings.","Strip units/whitespace from user input before parsing.","Add schema-level type checks in studio config forms (input type=number)."],"tags":["config-validation","numeric-parse","illegal-argument"],"backgroundTag":"invalid-config-value","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}