{"record":{"id":"e5583cc3ab947ae5","repo":"iflytek/astron-agent","slug":"response-failed-invalid-parameters-llmid-serviceid-cannot-be","errorCode":"RESPONSE_FAILED","errorMessage":"Invalid parameters: llmId/serviceId cannot be empty","messagePattern":"Invalid parameters: llmId/serviceId cannot be empty","errorType":"exception","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/model/ModelService.java","lineNumber":1251,"sourceCode":"        String uid = UserInfoManagerHandler.getUserId();\n        Model model = this.getById(modelId);\n        if (model == null) {\n            throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST);\n        }\n        if (!model.getUid().equals(uid)) {\n            log.warn(\"Unauthorized switch, uid={}, modelId={}\", uid, modelId);\n            throw new BusinessException(ResponseEnum.EXCEED_AUTHORITY);\n        }\n        model.setEnable(enable);\n        return ApiResult.success(this.updateById(model));\n    }\n\n\n    @Transactional(rollbackFor = Exception.class)\n    public Object offShelfModel(Long llmId, String flowId, String serviceId) {\n        // 0) Parameter validation\n        if (llmId == null) {\n            throw new BusinessException(ResponseEnum.RESPONSE_FAILED, \"Invalid parameters: llmId/serviceId cannot be empty\");\n        }\n\n        // 1) Calculate operable workflow set (only query necessary columns, reduce IO)\n        LambdaQueryWrapper<Workflow> lqw = new LambdaQueryWrapper<Workflow>()\n                .select(Workflow::getId, Workflow::getFlowId, Workflow::getData, Workflow::getUpdateTime, Workflow::getDeleted);\n        if (StringUtils.isNotBlank(flowId)) {\n            lqw.eq(Workflow::getFlowId, flowId);\n        } else {\n            // Only do replacement within workflows containing oldServiceId in data, avoid accidental damage\n            lqw.like(Workflow::getData, serviceId);\n        }\n        lqw.eq(Workflow::getDeleted, false);\n        List<Workflow> workflows = workflowMapper.selectList(lqw);\n        if (CollUtil.isEmpty(workflows)) {\n            throw new BusinessException(ResponseEnum.RESPONSE_FAILED, \"Flow list data is empty\");\n        }\n\n        ConfigInfo configInfo = configInfoMapper.getByCategoryAndCode(\"NODE_PREFIX_MODEL\", \"switch\");","sourceCodeStart":1233,"sourceCodeEnd":1269,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/model/ModelService.java#L1233-L1269","documentation":"Thrown by ModelService.offShelfModel when llmId is null. The method removes a model from shelves/workflows and needs the model id to locate the target; without it the operation is refused with RESPONSE_FAILED and the message 'Invalid parameters: llmId/serviceId cannot be empty'.","triggerScenarios":"Calling offShelfModel(llmId=null, flowId, serviceId) — e.g. a caller that only passes flowId/serviceId, an unmapped request parameter, or JSON body missing the llmId field.","commonSituations":"Frontend form omits the hidden llmId field; API integration passes the shelf id where the personal model id (or vice versa) is expected; parameter name mismatch so Spring binds null.","solutions":["Always supply a non-null llmId (the model's database id) when calling offShelfModel.","Check the controller binding: ensure the request param/body field name matches so llmId is populated.","If operating only on workflows, pass flowId/serviceId correctly, but llmId remains mandatory.","Add client-side validation that rejects the request before sending when llmId is absent."],"exampleFix":"// before\nmodelService.offShelfModel(null, flowId, serviceId);\n// after\nif (llmId == null) {\n    throw new IllegalArgumentException(\"llmId is required to off-shelf a model\");\n}\nmodelService.offShelfModel(llmId, flowId, serviceId);","handlingStrategy":"validation","validationCode":"if (llmId == null) {\n    throw new IllegalArgumentException(\"llmId is required\");\n}\nmodelService.offShelfModel(llmId, flowId, serviceId);","typeGuard":"boolean ready = llmId != null && llmId > 0;","tryCatchPattern":"try { modelService.offShelfModel(llmId, flowId, serviceId); }\ncatch (BusinessException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"llmId\")) {\n    throw new IllegalArgumentException(\"Caller bug: llmId was null\");\n  }\n  throw e;\n}","preventionTips":["Validate request DTOs at the controller with @NotNull","Keep parameter names consistent between client and API","Write integration tests covering missing-parameter cases"],"tags":["java","validation","missing-parameter"],"backgroundTag":"missing-required-argument","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}