{"record":{"id":"cf64f94be2bd38a6","repo":"iflytek/astron-agent","slug":"workflow-dls-upload-failed","errorCode":"WORKFLOW_DLS_UPLOAD_FAILED","errorMessage":"WORKFLOW_DLS_UPLOAD_FAILED","messagePattern":"WORKFLOW_DLS_UPLOAD_FAILED","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowYamlParser.java","lineNumber":163,"sourceCode":"        if (rawCollection == null) {\n            return;\n        }\n        if (!(rawCollection instanceof Collection<?> collection)\n                || collection.stream()\n                        .anyMatch(item -> !(item instanceof Map<?, ?>)\n                                && !(allowStrings && item instanceof String))) {\n            throw invalidWorkflowDsl(null);\n        }\n    }\n\n    private static BusinessException invalidWorkflowDsl(Throwable cause) {\n        if (cause != null) {\n            log.warn(\"workflow DSL validation failed: {}\", cause.getMessage());\n        }\n        return new BusinessException(ResponseEnum.WORKFLOW_DLS_UPLOAD_FAILED);\n    }\n\n    private static String stringValue(Object value) {\n        return value == null ? null : String.valueOf(value);\n    }\n\n    record ParsedWorkflowDsl(\n            Map<String, Object> meta, Map<String, Object> flow, Object dependencyManifest) {}\n}\n","sourceCodeStart":145,"sourceCodeEnd":170,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowYamlParser.java#L145-L170","documentation":"WorkflowYamlParser builds this BusinessException(ResponseEnum.WORKFLOW_DLS_UPLOAD_FAILED) via its invalidWorkflowDsl(cause) helper whenever the uploaded workflow YAML does not match the expected DSL shape (wrong/missing meta, flow, or dependencyManifest structure). Before throwing, the underlying cause's message is logged as 'workflow DSL validation failed'. The caller (validateWorkflowDslShape) invokes stringValue/mapping coercions on parsed map values and rejects anything that isn't the expected type.","triggerScenarios":"Importing YAML whose top-level `meta` or `flow` is missing or not a Map; values that should be strings are numbers/booleans/null; flow nodes list missing or not a list; the parser's validateWorkflowDslShape throws after stringValue/coercion detects an invalid field.","commonSituations":"Hand-authoring workflow YAML instead of exporting from the editor; YAML unquoted IDs parsed as ints; camelCase/snake_case mismatch after schema change; importing a DSL from a different product version.","solutions":["Check server logs for the line `workflow DSL validation failed: <msg>` immediately preceding this error — it names the exact field that failed.","Re-export a working workflow from the UI and diff its YAML structure (meta, flow, dependencyManifest keys and types) against your file.","Quote string values that look numeric (e.g. nodeId: \"123\"), ensure meta/flow are maps, and confirm the DSL version matches the backend."],"exampleFix":"// before (bad YAML)\nflow:\n  123: startNode\n// after\nmeta:\n  name: my-workflow\nflow:\n  nodes:\n    - id: \"123\"\n      type: start","handlingStrategy":"validation","validationCode":"const dsl = yaml.load(text);\nif (!dsl || typeof dsl !== 'object') throw new Error('not a mapping');\nif (!dsl.meta || typeof dsl.meta !== 'object') throw new Error('missing meta map');\nif (!dsl.flow || typeof dsl.flow !== 'object') throw new Error('missing flow map');","typeGuard":"function isWorkflowDsl(v) {\n  return v != null && typeof v === 'object'\n    && !Array.isArray(v)\n    && v.meta != null && typeof v.meta === 'object'\n    && v.flow != null && typeof v.flow === 'object';\n}","tryCatchPattern":"try {\n    const res = await api.importWorkflow(yamlText);\n} catch (e) {\n    if (e.code === 'WORKFLOW_DLS_UPLOAD_FAILED') showError('DSL structure invalid: check meta/flow sections and field types');\n    throw e;\n}","preventionTips":["Validate the YAML against the DSL JSON schema client-side before upload.","Quote identifiers that could parse as numbers or booleans.","Round-trip test: export a workflow, re-import it, assert success in CI."],"tags":["workflow","yaml","dsl-validation","import"],"backgroundTag":"schema-validation-failed","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"}