{"record":{"id":"2c9e139b1979898e","repo":"iflytek/astron-agent","slug":"response-failed-2c9e13","errorCode":"RESPONSE_FAILED","errorMessage":"Invalid parameters: llmId/serviceId cannot be null","messagePattern":"Invalid parameters: llmId/serviceId cannot be null","errorType":"exception","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/model/ShelfModelService.java","lineNumber":52,"sourceCode":"    @Autowired\n    private ConfigInfoMapper configInfoMapper;\n    @Resource\n    private WorkflowService workflowService;\n\n    /**\n     * Remove model from shelf and update related workflows\n     *\n     * @param llmId The LLM model ID to remove from shelf\n     * @param flowId Specific workflow ID to update (optional)\n     * @param serviceId The service ID of the model being removed\n     * @return Processing result\n     * @throws BusinessException if parameters are invalid or operation fails\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 null\");\n        }\n\n        // 1) Calculate operable workflow set (query only necessary columns to 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 replace in workflows containing oldServiceId in data to avoid accidental damage\n            lqw.like(Workflow::getData, serviceId);\n        }\n        lqw.eq(Workflow::getDeleted, false);\n        List<Workflow> workflows = workflowService.list(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":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/model/ShelfModelService.java#L34-L70","documentation":"Thrown by ShelfModelService.offShelfModel during its parameter validation step: llmId is null. This is the shelf-service variant of the same off-shelf operation in ModelService (error 485), with nearly identical wording ('cannot be null' vs 'cannot be empty'). The method cannot locate the model to remove from shelves without the id.","triggerScenarios":"Invoking ShelfModelService.offShelfModel(llmId=null, flowId, serviceId) — missing request parameter, mis-bound body field, or caller passing only flowId/serviceId.","commonSituations":"Migration from ModelService.offShelfModel to ShelfModelService with a renamed parameter that no longer binds; orchestrators that conditionally set llmId; typo in the request field name.","solutions":["Pass a non-null llmId (the model id) to offShelfModel.","Fix request parameter names/binding so llmId reaches the service method.","Add early validation in the calling layer to fail fast with a clear message.","Distinguish id spaces: the shelf service expects the shelf/model id it manages — confirm the correct id type is sent."],"exampleFix":"// before\nshelfModelService.offShelfModel(config.getLlmId(), flowId, serviceId); // getLlmId() may be null\n// after\nLong llmId = config.getLlmId();\nObjects.requireNonNull(llmId, \"config.llmId must be set before off-shelf\");\nshelfModelService.offShelfModel(llmId, flowId, serviceId);","handlingStrategy":"validation","validationCode":"if (llmId == null || llmId <= 0) {\n    throw new IllegalArgumentException(\"llmId must be a positive id\");\n}\nshelfModelService.offShelfModel(llmId, flowId, serviceId);","typeGuard":"boolean ready = llmId != null && llmId > 0;","tryCatchPattern":"try { shelfModelService.offShelfModel(llmId, flowId, serviceId); }\ncatch (BusinessException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"cannot be null\")) {\n    throw new IllegalArgumentException(\"llmId is mandatory for offShelfModel\");\n  }\n  throw e;\n}","preventionTips":["Null-check configuration values that feed llmId before the call","Use @RequestParam(required = true)/@NotNull at the controller boundary","Add unit tests asserting offShelfModel rejects null llmId"],"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"}