iflytek/astron-agent · error · BusinessException

RESPONSE_FAILED

RESPONSE_FAILED

Error message

Invalid parameters: llmId/serviceId cannot be null

What it means

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.

Solutions

  1. Pass a non-null llmId (the model id) to offShelfModel.
  2. Fix request parameter names/binding so llmId reaches the service method.
  3. Add early validation in the calling layer to fail fast with a clear message.
  4. Distinguish id spaces: the shelf service expects the shelf/model id it manages — confirm the correct id type is sent.

Example fix

// before
shelfModelService.offShelfModel(config.getLlmId(), flowId, serviceId); // getLlmId() may be null
// after
Long llmId = config.getLlmId();
Objects.requireNonNull(llmId, "config.llmId must be set before off-shelf");
shelfModelService.offShelfModel(llmId, flowId, serviceId);
Defensive patterns

Strategy: validation

Validate before calling

if (llmId == null || llmId <= 0) {
    throw new IllegalArgumentException("llmId must be a positive id");
}
shelfModelService.offShelfModel(llmId, flowId, serviceId);

Type guard

boolean ready = llmId != null && llmId > 0;

Try / catch

try { shelfModelService.offShelfModel(llmId, flowId, serviceId); }
catch (BusinessException e) {
  if (e.getMessage() != null && e.getMessage().contains("cannot be null")) {
    throw new IllegalArgumentException("llmId is mandatory for offShelfModel");
  }
  throw e;
}

Prevention

When it happens

Trigger: Invoking ShelfModelService.offShelfModel(llmId=null, flowId, serviceId) — missing request parameter, mis-bound body field, or caller passing only flowId/serviceId.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/2c9e139b1979898e. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/model/ShelfModelService.java:52

    @Autowired
    private ConfigInfoMapper configInfoMapper;
    @Resource
    private WorkflowService workflowService;

    /**
     * Remove model from shelf and update related workflows
     *
     * @param llmId The LLM model ID to remove from shelf
     * @param flowId Specific workflow ID to update (optional)
     * @param serviceId The service ID of the model being removed
     * @return Processing result
     * @throws BusinessException if parameters are invalid or operation fails
     */
    @Transactional(rollbackFor = Exception.class)
    public Object offShelfModel(Long llmId, String flowId, String serviceId) {
        // 0) Parameter validation
        if (llmId == null) {
            throw new BusinessException(ResponseEnum.RESPONSE_FAILED, "Invalid parameters: llmId/serviceId cannot be null");
        }

        // 1) Calculate operable workflow set (query only necessary columns to reduce IO)
        LambdaQueryWrapper<Workflow> lqw = new LambdaQueryWrapper<Workflow>()
                .select(Workflow::getId, Workflow::getFlowId, Workflow::getData, Workflow::getUpdateTime, Workflow::getDeleted);
        if (StringUtils.isNotBlank(flowId)) {
            lqw.eq(Workflow::getFlowId, flowId);
        } else {
            // Only replace in workflows containing oldServiceId in data to avoid accidental damage
            lqw.like(Workflow::getData, serviceId);
        }
        lqw.eq(Workflow::getDeleted, false);
        List<Workflow> workflows = workflowService.list(lqw);
        if (CollUtil.isEmpty(workflows)) {
            throw new BusinessException(ResponseEnum.RESPONSE_FAILED, "Flow list data is empty");
        }

        ConfigInfo configInfo = configInfoMapper.getByCategoryAndCode("NODE_PREFIX_MODEL", "switch");

View on GitHub (pinned to 5e758547a8)