iflytek/astron-agent · error · BusinessException

8113

8113

Error message

workflow.export.failed

What it means

exportYaml() exports a workflow as YAML. Before streaming the file it loads the workflow entity; if the id does not exist or the entity's data column is empty, it throws BusinessException(ResponseEnum.WORKFLOW_EXPORT_FAILED) (code 8113, message key workflow.export.failed). This is a pre-flight guard preventing an empty download.

Solutions

  1. Verify the workflow id exists via GET /workflow detail or the workflow list before calling export.
  2. Re-save the workflow so its data (DSL) field is populated, then retry the export.
  3. If the workflow was deleted, recreate it or restore it from backup; export cannot proceed without data.
  4. Client-side: catch the 8113 error and prompt the user that the workflow is missing or empty instead of downloading.

Example fix

// before
const blob = await fetch(`/workflow/export/${id}`) // id may be stale

// after
const wf = await fetch(`/workflow/detail/${id}`).then(r => r.json())
if (!wf?.data) throw new Error('Workflow has no DSL data to export')
const blob = await fetch(`/workflow/export/${id}`)
Defensive patterns

Strategy: validation

Validate before calling

const wf = await api.get(`/workflow/detail/${id}`).catch(() => null);
if (!wf || !wf.data) {
  throw new Error(`Workflow ${id} missing or has no DSL data; export aborted`);
}

Try / catch

try {
  await downloadYaml(id);
} catch (e) {
  if (e.code === 8113) notify('Workflow not found or empty — cannot export');
  else throw e;
}

Prevention

When it happens

Trigger: GET /workflow/export/{id} where the id has no matching workflow row, or the row exists but its data field is null/blank.

Common situations: Stale frontend link after the workflow was deleted; exporting a workflow that was created but never saved with DSL data; wrong id passed from another environment/database; soft-deleted record still referenced in the UI.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/controller/workflow/WorkflowController.java:464

    @GetMapping("/get-workflow-prompt-status")
    public Object getWorkflowPromptStatus(@RequestParam @NotNull Long id) {
        return workflowService.getWorkflowPromptStatus(id);
    }

    // ---------------------- Export/Import YAML ----------------------

    /**
     * Export workflow as YAML.
     *
     * <p>
     * Note: Add filename to avoid browser downloading as unnamed file.
     */
    @GetMapping("/export/{id}")
    public void exportYaml(@PathVariable @NotNull Long id, HttpServletResponse response) {
        final Workflow entity = workflowService.getById(id);
        try {
            if (entity == null || StringUtils.isEmpty(entity.getData())) {
                throw new BusinessException(ResponseEnum.WORKFLOW_EXPORT_FAILED);
            }
            // Construct download filename: workflow-{id}.yaml
            final String filename =
                    URLEncoder.encode("workflow-" + id + ".yaml", StandardCharsets.UTF_8).replaceAll("\\+", "%20");

            response.setContentType("application/octet-stream");
            response.setCharacterEncoding(StandardCharsets.UTF_8.name());
            response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + filename);

            workflowExportService.exportWorkflowDataAsYaml(entity, response.getOutputStream());
            response.flushBuffer();
        } catch (BusinessException e) {
            log.error("export yaml business error, id={}", id, e);
            throw e;
        } catch (Exception e) {
            log.error("export yaml unexpected error, id={}", id, e);
            throw new BusinessException(ResponseEnum.WORKFLOW_EXPORT_FAILED);
        }

View on GitHub (pinned to 5e758547a8)