iflytek/astron-agent · warning

Repair exported workflow template snapshot failed…

Error message

Repair exported workflow template snapshot failed, templateId={}

What it means

WARN from loadAvailableTemplate's repair path: when a template's snapshotYaml is blank, the code tries to regenerate it from the source workflow and persist it; any exception during that repair is caught, logged, and swallowed — the possibly-blank template is still returned (leading to BOT_NOT_EXIST downstream).

Solutions

  1. Check the attached stack trace for the root cause (usually missing source workflow or DB error) and restore/regenerate the snapshot.
  2. Re-export the template from an existing workflow to replace the broken one.
  3. Consider rethrowing or returning null on repair failure instead of returning a template with a blank snapshot, so callers fail fast with a clear reason.

Example fix

// before
catch (Exception e) {
    log.warn("Repair exported workflow template snapshot failed, templateId={}", templateId, e);
}
return template;
// after
catch (Exception e) {
    log.warn("Repair exported workflow template snapshot failed, templateId={}", templateId, e);
    return null; // let callers surface BOT_NOT_EXIST with a clear cause
}
Defensive patterns

Strategy: try-catch

Validate before calling

boolean snapshotReady = template != null && StringUtils.isNotBlank(template.getSnapshotYaml());

Try / catch

try {
    createFromTemplate(uid, templateId);
} catch (BusinessException e) {
    log.error("Template {} unusable, snapshot repair likely failed", templateId, e);
    reExportTemplate(sourceWorkflowId);
}

Prevention

When it happens

Trigger: Template references a sourceWorkflowId that is missing/corrupt, or exportWorkflowSnapshot/updateById throws (DB error, serialization error) during the lazy repair.

Common situations: Source workflow deleted or migrated after template export; database connectivity issues during repair; YAML serialization failure for legacy workflow definitions.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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

Appendix: source

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

        }

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

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

        try {
            template.setSnapshotYaml(exportWorkflowSnapshot(sourceWorkflow));
            exportedWorkflowTemplateMapper.updateById(template);
            log.info("Repaired exported workflow template snapshot, templateId={}, sourceWorkflowId={}",
                    templateId,
                    template.getSourceWorkflowId());
        } catch (Exception e) {
            log.warn("Repair exported workflow template snapshot failed, templateId={}", templateId, e);
        }
        return template;
    }

    @Override
    public Integer maasCopySynchronize(CloneSynchronize synchronize) {
        log.info("------ Astron workflow copy synchronization: {}", JSONObject.toJSONString(synchronize));
        String uid = synchronize.getUid();
        Long originId = synchronize.getOriginId();
        Long maasId = synchronize.getCurrentId();
        String flowId = synchronize.getFlowId();
        Long spaceId = synchronize.getSpaceId();
        UserLangChainInfo userLangChainInfo = userLangChainDataService.selectByMaasId(originId);
        if (Objects.isNull(userLangChainInfo)) {
            log.info("----- Xinghuo did not find Astron workflow: {}", JSONObject.toJSONString(synchronize));
            throw new BusinessException(ResponseEnum.BOT_NOT_EXIST);
        }
        Integer botId = userLangChainInfo.getBotId();

View on GitHub (pinned to 5e758547a8)