{"record":{"id":"ed79e328fda0d8de","repo":"alibaba/spring-ai-alibaba","slug":"invalid-params-ed79e3","errorCode":"INVALID_PARAMS","errorMessage":"input_params","messagePattern":"input_params","errorType":"exception","errorClass":"BizException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/controller/ProviderController.java","lineNumber":113,"sourceCode":"\t\tthis.modelManager = modelManager;\n\t\tthis.redisManager = redisManager;\n\t}\n\n\t/**\n\t * Adds a new model provider to the system.\n\t *\n\t * This endpoint creates a new provider with the following features: - Generates a\n\t * unique provider code - Configures provider metadata (name, description, icon) -\n\t * Sets up supported model types - Handles credential encryption for sensitive data -\n\t * Manages protocol-specific configurations\n\t * @param request The provider creation request containing provider details\n\t * @return Result indicating success or failure of the operation\n\t * @throws BizException if required parameters are missing or invalid\n\t */\n\t@PostMapping\n\tpublic Result<Boolean> addProvider(@RequestBody AddProviderRequest request) {\n\t\tif (request == null || StringUtils.isBlank(request.getName())) {\n\t\t\tthrow new BizException(ErrorCode.INVALID_PARAMS.toError(\"input_params\", \"request is valid\"));\n\t\t}\n\n\t\t// Create provider configuration information\n\t\tProviderConfigInfo providerConfigInfo = new ProviderConfigInfo();\n\t\t// Generate an 8-character random code\n\t\tString providerCode = IdGenerator.uuid().substring(0, 8);\n\t\tproviderConfigInfo.setProvider(providerCode);\n\t\tproviderConfigInfo.setName(request.getName());\n\t\tproviderConfigInfo.setDescription(request.getDescription());\n\t\tproviderConfigInfo.setIcon(request.getIcon());\n\t\tproviderConfigInfo.setSource(DataSourceEnum.custom.name());\n\t\tproviderConfigInfo.setEnable(true);\n\t\tList<String> supportedModelTypes = Lists.newArrayList();\n\t\tif (StringUtils.isNotBlank(request.getSupportedModelTypes())) {\n\t\t\tsupportedModelTypes\n\t\t\t\t.addAll(Arrays.stream(request.getSupportedModelTypes().split(\",\")).collect(Collectors.toList()));\n\t\t}\n\t\telse {","sourceCodeStart":95,"sourceCodeEnd":131,"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/builder/controller/ProviderController.java#L95-L131","documentation":"ProviderController.addProvider throws this when the request body is null or request.getName() is blank. Unlike validateTool's per-field checks, the whole payload is validated with a single INVALID_PARAMS error keyed 'input_params' (message 'request is valid' — a wording quirk meaning the request is invalid). The provider name is required to register a model provider configuration.","triggerScenarios":"POST to the provider endpoint with an empty body, or a body where `name` is missing/empty: {\"name\":\"\"}.","commonSituations":"Front-end submitting the provider form before the name field is filled; empty-body POSTs (no Content-Type: application/json causing null deserialization); API clients omitting the name field after a contract change.","solutions":["Send a JSON body with a non-blank `name` field and Content-Type: application/json","Validate name non-blank client-side before calling addProvider","Fix JSON key naming so Jackson maps the name field","Update clients still using the pre-name-era request shape"],"exampleFix":"// before\nPOST /provider\n{}\n// after\nPOST /provider (Content-Type: application/json)\n{\"name\":\"dashscope\",\"config\":{...}}","handlingStrategy":"validation","validationCode":"if (request == null || request.getName() == null || request.getName().isBlank()) { throw new IllegalArgumentException(\"provider request with non-blank name is required\"); }","typeGuard":"boolean hasName(AddProviderRequest r) { return r != null && r.getName() != null && !r.getName().isBlank(); }","tryCatchPattern":"try { providerController.addProvider(request); } catch (BizException e) { if (\"input_params\".equals(e.getMessage())) { /* resend with a populated name */ } }","preventionTips":["Send POST bodies with Content-Type: application/json so the body deserializes","Make provider name required in the registration UI","Validate the request object before invoking addProvider","Keep clients aligned with the AddProviderRequest schema"],"tags":["validation","http-api","spring","invalid-params"],"backgroundTag":"invalid-argument-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"}