{"record":{"id":"f82fc6cdb9664ccf","repo":"iflytek/astron-agent","slug":"import-workflow-rejected-filename-code","errorCode":null,"errorMessage":"import workflow rejected, filename={}, code={}","messagePattern":"import workflow rejected, filename=(.+?), code=(.+?)","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"warning","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/controller/workflow/WorkflowController.java","lineNumber":501,"sourceCode":"    }\n\n    /**\n     * Import workflow from YAML.\n     */\n    @PostMapping(\"/import\")\n    @SpacePreAuth(\n            key = \"WorkflowController_importWorkflow_POST\",\n            module = \"Workflow\",\n            point = \"Workflow Import\",\n            description = \"Workflow Import\")\n    public Object importWorkflow(@RequestParam(\"file\") MultipartFile file, HttpServletRequest request) {\n        if (file == null || file.isEmpty() || file.getSize() > MAX_WORKFLOW_IMPORT_BYTES) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_DLS_UPLOAD_FAILED);\n        }\n        try (InputStream inputStream = file.getInputStream()) {\n            return workflowExportService.importWorkflowFromYaml(inputStream, request);\n        } catch (BusinessException e) {\n            log.warn(\"import workflow rejected, filename={}, code={}\",\n                    file.getOriginalFilename(), e.getCode());\n            throw e;\n        } catch (Exception e) {\n            log.error(\"import workflow failed, filename={}\", file.getOriginalFilename(), e);\n            throw new BusinessException(ResponseEnum.WORKFLOW_IMPORT_FAILED);\n        }\n    }\n\n    // ---------------------- Prompt Comparison (Save/List) ----------------------\n\n    @PostMapping(\"/save-comparisons\")\n    public ApiResult<String> saveComparisons(@RequestBody @NotNull List<WorkflowComparisonSaveReq> workflowComparisonReqList) {\n        return ApiResult.success(workflowService.saveComparisons(workflowComparisonReqList));\n    }\n\n    @GetMapping(\"/list-comparisons\")\n    public List<WorkflowComparison> listComparisons(@RequestParam @NotBlank String promptId) {\n        return workflowService.listComparisons(promptId);","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/controller/workflow/WorkflowController.java#L483-L519","documentation":"WorkflowController.importWorkflow logs this warning when workflowExportService.importWorkflowFromYaml throws a BusinessException — the YAML import was rejected by validation with a specific code (e.g. WORKFLOW_DLS_UPLOAD_FAILED, code 8125). The original exception is re-thrown unchanged after logging the filename and code, so the client receives the precise rejection reason.","triggerScenarios":"POSTing a workflow import file where file == null, file.isEmpty(), or file.getSize() > MAX_WORKFLOW_IMPORT_BYTES (throws WORKFLOW_DLS_UPLOAD_FAILED directly), or the YAML parses but fails DSL shape/manifest validation inside the export service.","commonSituations":"Users uploading oversized or empty files via the workflow import UI; hand-edited workflow YAML missing required meta/flow sections; DSL exported from a newer version parsed by an older backend.","solutions":["Read the returned `code` in the response: 8125 (WORKFLOW_DLS_UPLOAD_FAILED) means the file was empty, over the size limit, or failed DSL validation — fix the file content/size and retry.","If WORKFLOW_IMPORT_FAILED is returned instead (generic exception), check server logs for the accompanying error stack to find the real parsing failure.","Validate the YAML against a known-good export from the same version before importing; ensure required sections (meta, flow, dependencyManifest) exist and the dependency manifest entry count is within limits."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"final long MAX_BYTES = 5 * 1024 * 1024; // match MAX_WORKFLOW_IMPORT_BYTES\n// client-side pre-check before upload\nif (file == null || file.size === 0 || file.size > MAX_BYTES) {\n    alert('File is empty or exceeds the workflow import size limit');\n}","typeGuard":null,"tryCatchPattern":"try {\n    await api.importWorkflow(file);\n} catch (e) {\n    if (e.code === 8125) showError('Invalid workflow DSL: check YAML structure and size');\n    else showError('Workflow import failed — see server logs');\n}","preventionTips":["Enforce the file size/emptiness check in the upload UI before the request is sent.","Only import YAML produced by the same backend version's export function.","Catch the specific 8125 code to distinguish validation rejections from generic import failures."],"tags":["workflow","import","validation","yaml"],"backgroundTag":"yaml-parse-error","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}