iflytek/astron-agent · warning

Exported workflow template unavailable, templateId=

Error message

Exported workflow template unavailable, templateId={}, uid={}, templateFound={}, isDelete={}

What it means

WARN from loadAvailableTemplate: the ExportedWorkflowTemplate lookup by templateId returned null or the row is soft-deleted (isDelete != 0). loadAvailableTemplate returns null, which callers translate into BOT_NOT_EXIST exceptions.

Solutions

  1. Verify templateId exists and isDelete=0 before use (e.g. SELECT is_delete FROM exported_workflow_template WHERE id=?).
  2. Refresh the template list on the client so deleted templates are no longer referenced.
  3. If templates should be space-visible, include the space/uid filter in lookup logic and surface a clear not-found message.

Example fix

// before
Long templateId = dto.getTemplateId(); // possibly stale
service.createFromTemplate(uid, templateId);
// after
ExportedWorkflowTemplate t = exportedWorkflowTemplateMapper.selectById(dto.getTemplateId());
if (t == null || t.getIsDelete() != 0) { throw new BusinessException(ResponseEnum.BOT_NOT_EXIST); }
Defensive patterns

Strategy: validation

Validate before calling

boolean templateAvailable = java.util.Optional.ofNullable(exportedWorkflowTemplateMapper.selectById(id))
    .map(t -> Objects.equals(t.getIsDelete(), (byte) 0)).orElse(false);

Prevention

When it happens

Trigger: selectById misses (wrong/foreign templateId), or template.getIsDelete() is 1 because it was deleted via deleteTemplate.

Common situations: Using a templateId from another space/tenant; referencing a template deleted by its creator; hardcoded templateIds in tests/config after data cleanup.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

            throw new BusinessException(ResponseEnum.WORKFLOW_IMPORT_FAILED);
        }

        JSONObject ext = JSONObject.parseObject(importedWorkflow.getExt());
        BotInfoDto botInfoDto = new BotInfoDto();
        botInfoDto.setBotId(ext == null ? null : ext.getInteger("botId"));
        botInfoDto.setBotName(importedWorkflow.getName());
        botInfoDto.setBotDesc(importedWorkflow.getDescription());
        botInfoDto.setAvatar(importedWorkflow.getAvatarIcon());
        botInfoDto.setVersion(BotVersionEnum.WORKFLOW.getVersion());
        botInfoDto.setFlowId(importedWorkflow.getId());
        botInfoDto.setMaasId(importedWorkflow.getId());
        return botInfoDto;
    }

    private ExportedWorkflowTemplate loadAvailableTemplate(String uid, Long templateId) {
        ExportedWorkflowTemplate template = exportedWorkflowTemplateMapper.selectById(templateId);
        if (template == null || !Objects.equals(template.getIsDelete(), (byte) 0)) {
            log.warn("Exported workflow template unavailable, templateId={}, uid={}, templateFound={}, isDelete={}",
                    templateId,
                    uid,
                    template != null,
                    template == null ? null : template.getIsDelete());
            return null;
        }

        if (StringUtils.isNotBlank(template.getSnapshotYaml())) {
            return template;
        }

        if (template.getSourceWorkflowId() == null) {
            return template;
        }

        Workflow sourceWorkflow = workflowService.getById(template.getSourceWorkflowId());
        if (sourceWorkflow == null) {
            return template;

View on GitHub (pinned to 5e758547a8)