iflytek/astron-agent · error · BusinessException

WORKFLOW_DLS_UPLOAD_FAILED

WORKFLOW_DLS_UPLOAD_FAILED

Error message

WORKFLOW_DLS_UPLOAD_FAILED

What it means

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.

Solutions

  1. Check server logs for the line `workflow DSL validation failed: <msg>` immediately preceding this error — it names the exact field that failed.
  2. Re-export a working workflow from the UI and diff its YAML structure (meta, flow, dependencyManifest keys and types) against your file.
  3. Quote string values that look numeric (e.g. nodeId: "123"), ensure meta/flow are maps, and confirm the DSL version matches the backend.

Example fix

// before (bad YAML)
flow:
  123: startNode
// after
meta:
  name: my-workflow
flow:
  nodes:
    - id: "123"
      type: start
Defensive patterns

Strategy: validation

Validate before calling

const dsl = yaml.load(text);
if (!dsl || typeof dsl !== 'object') throw new Error('not a mapping');
if (!dsl.meta || typeof dsl.meta !== 'object') throw new Error('missing meta map');
if (!dsl.flow || typeof dsl.flow !== 'object') throw new Error('missing flow map');

Type guard

function isWorkflowDsl(v) {
  return v != null && typeof v === 'object'
    && !Array.isArray(v)
    && v.meta != null && typeof v.meta === 'object'
    && v.flow != null && typeof v.flow === 'object';
}

Try / catch

try {
    const res = await api.importWorkflow(yamlText);
} catch (e) {
    if (e.code === 'WORKFLOW_DLS_UPLOAD_FAILED') showError('DSL structure invalid: check meta/flow sections and field types');
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowYamlParser.java:163

        if (rawCollection == null) {
            return;
        }
        if (!(rawCollection instanceof Collection<?> collection)
                || collection.stream()
                        .anyMatch(item -> !(item instanceof Map<?, ?>)
                                && !(allowStrings && item instanceof String))) {
            throw invalidWorkflowDsl(null);
        }
    }

    private static BusinessException invalidWorkflowDsl(Throwable cause) {
        if (cause != null) {
            log.warn("workflow DSL validation failed: {}", cause.getMessage());
        }
        return new BusinessException(ResponseEnum.WORKFLOW_DLS_UPLOAD_FAILED);
    }

    private static String stringValue(Object value) {
        return value == null ? null : String.valueOf(value);
    }

    record ParsedWorkflowDsl(
            Map<String, Object> meta, Map<String, Object> flow, Object dependencyManifest) {}
}

View on GitHub (pinned to 5e758547a8)