iflytek/astron-agent · error · BusinessException

8118

8118

Error message

workflow.import.failed

What it means

This is the catch-all branch of importWorkflow(). BusinessExceptions from YAML validation are rethrown unchanged, but any other Exception during parsing/import (malformed YAML, IO errors reading the stream, service-layer runtime failures) is logged and wrapped as BusinessException(ResponseEnum.WORKFLOW_IMPORT_FAILED) (code 8118, message workflow.import.failed).

Solutions

  1. Read the server log 'import workflow failed, filename=...' for the root-cause exception (usually a YAML/schema parse error).
  2. Validate the YAML structure against a known-good export from the same platform version; re-export instead of hand-editing.
  3. Confirm the file is valid UTF-8 text YAML, not binary or truncated.
  4. If the schema changed between versions, migrate the DSL fields to the current format before importing.

Example fix

// before
name: my workflow
nodes: "not-a-list"

// after
name: my workflow
nodes:
  - id: node-1
    type: llm
Defensive patterns

Strategy: validation

Validate before calling

const text = await file.text();
try { YAML.parse(text); } catch (e) { throw new Error('Invalid YAML: ' + e.message); }
if (!text.includes('nodes')) throw new Error('YAML missing required workflow DSL fields');

Try / catch

try {
  await importWorkflowYaml(file);
} catch (e) {
  if (e.code === 8118) {
    console.error('Import failed; check server log: import workflow failed, filename=...');
    notify('YAML could not be imported — verify format and platform version');
  } else throw e;
}

Prevention

When it happens

Trigger: POST /workflow/import where workflowExportService.importWorkflowFromYaml throws a non-BusinessException: YAML that fails to deserialize into the workflow DSL schema, a corrupted stream, or an unexpected NPE inside the import service.

Common situations: Hand-edited YAML with wrong indentation or missing required DSL fields; YAML exported by an older/newer platform version whose schema changed; binary or non-UTF-8 file uploaded; truncated download re-uploaded.

Related errors


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

Appendix: source

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

    @PostMapping("/import")
    @SpacePreAuth(
            key = "WorkflowController_importWorkflow_POST",
            module = "Workflow",
            point = "Workflow Import",
            description = "Workflow Import")
    public Object importWorkflow(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
        if (file == null || file.isEmpty() || file.getSize() > MAX_WORKFLOW_IMPORT_BYTES) {
            throw new BusinessException(ResponseEnum.WORKFLOW_DLS_UPLOAD_FAILED);
        }
        try (InputStream inputStream = file.getInputStream()) {
            return workflowExportService.importWorkflowFromYaml(inputStream, request);
        } catch (BusinessException e) {
            log.warn("import workflow rejected, filename={}, code={}",
                    file.getOriginalFilename(), e.getCode());
            throw e;
        } catch (Exception e) {
            log.error("import workflow failed, filename={}", file.getOriginalFilename(), e);
            throw new BusinessException(ResponseEnum.WORKFLOW_IMPORT_FAILED);
        }
    }

    // ---------------------- Prompt Comparison (Save/List) ----------------------

    @PostMapping("/save-comparisons")
    public ApiResult<String> saveComparisons(@RequestBody @NotNull List<WorkflowComparisonSaveReq> workflowComparisonReqList) {
        return ApiResult.success(workflowService.saveComparisons(workflowComparisonReqList));
    }

    @GetMapping("/list-comparisons")
    public List<WorkflowComparison> listComparisons(@RequestParam @NotBlank String promptId) {
        return workflowService.listComparisons(promptId);
    }

    // ---------------------- Feedback ----------------------

    @PostMapping("/feedback")

View on GitHub (pinned to 5e758547a8)