iflytek/astron-agent · warning · BusinessException

PARAMETER_ERROR

PARAMETER_ERROR

Error message

PARAMETER_ERROR

What it means

Thrown at the top of createFromExportedTemplate when maasDuplicate.getTemplateId() is null. Creating a workflow from an exported template requires an explicit templateId; without it the request is malformed and rejected with PARAMETER_ERROR before any lookup.

Solutions

  1. Ensure the request body includes a non-null templateId when creating from an exported template
  2. Check the frontend form/API client actually sends templateId (inspect the outgoing JSON)
  3. Verify MaasDuplicate DTO field types match the incoming JSON so templateId is not dropped during deserialization
  4. Validate templateId in the controller layer and return a clear 400 message before reaching the service

Example fix

// before
MaasDuplicate maasDuplicate = ...; // templateId never set
botMaasService.createFromTemplate(uid, maasDuplicate, request);
// after
if (maasDuplicate.getTemplateId() == null) {
    throw new IllegalArgumentException("templateId is required when creating from an exported template");
}
botMaasService.createFromTemplate(uid, maasDuplicate, request);
Defensive patterns

Strategy: validation

Validate before calling

if (req == null || req.getTemplateId() == null) {
    return ApiResult.fail("templateId is required for exported-template creation");
}

Type guard

null

Try / catch

try {
    botMaasService.createFromTemplate(uid, req, httpRequest);
} catch (BusinessException e) {
    if (ResponseEnum.PARAMETER_ERROR.getCode().equals(e.getCode())) {
        // return 400 with 'templateId required'
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling createFromTemplate with a request whose type routes to the exported-template path but whose templateId field is missing/null (e.g. client omitted templateId in the body).

Common situations: Frontend not populating templateId for exported-template creation, API consumers copying payloads between official-template and exported-template flows, or DTO deserialization silently dropping the field due to a type mismatch.

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

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/workflow/impl/BotMaasServiceImpl.java:130

        // Check if response is successful
        if (botInfoDto == null) {
            throw new BusinessException(ResponseEnum.CREATE_BOT_FAILED);
        }
        // Copy a new workflow for the assistant
        JSONObject res = maasUtil.copyWorkFlow(maasDuplicate.getMaasId(), request, BotVersionEnum.WORKFLOW.getVersion(), Long.valueOf(botInfoDto.getBotId()), null);
        if (Objects.isNull(res) || res.isEmpty()) {
            throw new BusinessException(ResponseEnum.CREATE_BOT_FAILED);
        }
        Integer botId = botInfoDto.getBotId();
        botService.addMaasInfo(uid, res, botId, spaceId);
        botInfoDto.setFlowId(res.getJSONObject("data").getLong("id"));
        return botInfoDto;
    }

    private BotInfoDto createFromExportedTemplate(String uid, MaasDuplicate maasDuplicate, HttpServletRequest request) {
        Long templateId = maasDuplicate.getTemplateId();
        if (templateId == null) {
            throw new BusinessException(ResponseEnum.PARAMETER_ERROR);
        }

        ExportedWorkflowTemplate template = loadAvailableTemplate(uid, templateId);
        if (template == null || StringUtils.isBlank(template.getSnapshotYaml())) {
            log.warn("Create workflow from exported template failed, templateId={}, uid={}, spaceId={}, templateFound={}, snapshotBlank={}",
                    templateId,
                    uid,
                    SpaceInfoUtil.getSpaceId(),
                    template != null,
                    template == null || StringUtils.isBlank(template.getSnapshotYaml()));
            throw new BusinessException(ResponseEnum.BOT_NOT_EXIST);
        }

        ApiResult<?> importResult = workflowExportService.importWorkflowFromYaml(
                new ByteArrayInputStream(template.getSnapshotYaml().getBytes(StandardCharsets.UTF_8)),
                request);
        if (importResult.code() != 0 || !(importResult.data() instanceof Workflow importedWorkflow)) {
            throw new BusinessException(ResponseEnum.WORKFLOW_IMPORT_FAILED);

View on GitHub (pinned to 5e758547a8)