{"record":{"id":"dd1a4bce5c69bd98","repo":"alibaba/spring-ai-alibaba","slug":"unsupported-mode-metadata-getmode","errorCode":null,"errorMessage":"unsupported mode: ${metadata.getMode()}","messagePattern":"unsupported mode: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/generator/service/dsl/AbstractDSLAdapter.java","lineNumber":64,"sourceCode":"\n\tprotected NodeDataConverter<? extends NodeData> getNodeDataConverter(NodeType nodeType) {\n\t\treturn nodeDataConverters.stream()\n\t\t\t.filter(converter -> converter.supportNodeType(nodeType))\n\t\t\t.findFirst()\n\t\t\t.orElseThrow(() -> new IllegalArgumentException(\"invalid node type \" + nodeType));\n\t}\n\n\t@Override\n\tpublic App importDSL(String dsl) {\n\t\tlog.info(\"dsl importing: {}\", dsl);\n\t\tMap<String, Object> data = getSerializer().load(dsl);\n\t\tvalidateDSLData(data);\n\t\tMap<String, Object> immutableData = Map.copyOf(data);\n\t\tAppMetadata metadata = mapToMetadata(immutableData);\n\t\tObject spec = switch (metadata.getMode()) {\n\t\t\tcase AppMetadata.WORKFLOW_MODE -> mapToWorkflow(immutableData);\n\t\t\tcase AppMetadata.CHATBOT_MODE -> mapToChatBot(immutableData);\n\t\t\tdefault -> throw new IllegalArgumentException(\"unsupported mode: \" + metadata.getMode());\n\t\t};\n\t\tApp app = new App(metadata, spec);\n\t\tlog.info(\"App imported:{}\", app);\n\t\treturn app;\n\t}\n\n\t@Override\n\tpublic String exportDSL(App app) {\n\t\tlog.info(\"App exporting: \\n{}\", app);\n\t\tAppMetadata metadata = app.getMetadata();\n\t\tMap<String, Object> metaMap = metadataToMap(metadata);\n\t\tMap<String, Object> specMap;\n\t\tswitch (metadata.getMode()) {\n\t\t\tcase AppMetadata.WORKFLOW_MODE -> specMap = workflowToMap((Workflow) app.getSpec());\n\t\t\tcase AppMetadata.CHATBOT_MODE -> specMap = chatbotToMap((ChatBot) app.getSpec());\n\t\t\tdefault -> throw new IllegalArgumentException(\"unsupported mode: \" + metadata.getMode());\n\t\t}\n\t\tMap<String, Object> data = Stream.concat(metaMap.entrySet().stream(), specMap.entrySet().stream())","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/generator/service/dsl/AbstractDSLAdapter.java#L46-L82","documentation":"Thrown by AbstractDSLAdapter.importDSL when the imported DSL's metadata mode is neither the workflow nor chatbot mode. The adapter can only materialize specs for those two modes; any other mode string in the DSL is rejected.","triggerScenarios":"Importing a DSL file whose root metadata 'mode' field is 'agent', 'completion', or missing/misspelled, then hitting the switch's default branch.","commonSituations":"Dify DSLs of agent/completion apps, DSLs edited or truncated so the mode field is wrong, version skew between exporter and importer.","solutions":["Ensure the DSL's mode field is \"workflow\" or \"chatbot\"","Re-export the app in a supported mode from the source platform","Check the mode key wasn't corrupted or renamed in a hand edit"],"exampleFix":"// before\n# dsl metadata\nmode: agent-chat\n// after\nmode: workflow\n","handlingStrategy":"validation","validationCode":"Object mode = data.get(\"mode\"); if (!AppMetadata.WORKFLOW_MODE.equals(mode) && !AppMetadata.CHATBOT_MODE.equals(mode)) { throw new IllegalArgumentException(\"unsupported dsl mode: \" + mode); }","typeGuard":null,"tryCatchPattern":"try { adapter.importDSL(dsl); } catch (IllegalArgumentException e) { /* show 'only workflow/chatbot DSL supported' to user */ }","preventionTips":["Only import DSL exported from workflow or chatbot apps","Sanity-check DSL metadata before import","Handle agent apps with a dedicated adapter"],"tags":["invalid-enum-value","dsl-import","unsupported-mode"],"backgroundTag":"invalid-enum-value","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}