iflytek/astron-agent · error · BusinessException

RESPONSE_FAILED

RESPONSE_FAILED

Error message

Invalid parameters: llmId/serviceId cannot be empty

What it means

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'.

Solutions

  1. Always supply a non-null llmId (the model's database id) when calling offShelfModel.
  2. Check the controller binding: ensure the request param/body field name matches so llmId is populated.
  3. If operating only on workflows, pass flowId/serviceId correctly, but llmId remains mandatory.
  4. Add client-side validation that rejects the request before sending when llmId is absent.

Example fix

// before
modelService.offShelfModel(null, flowId, serviceId);
// after
if (llmId == null) {
    throw new IllegalArgumentException("llmId is required to off-shelf a model");
}
modelService.offShelfModel(llmId, flowId, serviceId);
Defensive patterns

Strategy: validation

Validate before calling

if (llmId == null) {
    throw new IllegalArgumentException("llmId is required");
}
modelService.offShelfModel(llmId, flowId, serviceId);

Type guard

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

Try / catch

try { modelService.offShelfModel(llmId, flowId, serviceId); }
catch (BusinessException e) {
  if (e.getMessage() != null && e.getMessage().contains("llmId")) {
    throw new IllegalArgumentException("Caller bug: llmId was null");
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

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

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/e5583cc3ab947ae5. Report an issue: GitHub.

Appendix: source

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

        String uid = UserInfoManagerHandler.getUserId();
        Model model = this.getById(modelId);
        if (model == null) {
            throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST);
        }
        if (!model.getUid().equals(uid)) {
            log.warn("Unauthorized switch, uid={}, modelId={}", uid, modelId);
            throw new BusinessException(ResponseEnum.EXCEED_AUTHORITY);
        }
        model.setEnable(enable);
        return ApiResult.success(this.updateById(model));
    }


    @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 empty");
        }

        // 1) Calculate operable workflow set (only query necessary columns, 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 do replacement within workflows containing oldServiceId in data, avoid accidental damage
            lqw.like(Workflow::getData, serviceId);
        }
        lqw.eq(Workflow::getDeleted, false);
        List<Workflow> workflows = workflowMapper.selectList(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)