{"record":{"id":"7c3678ee2248562d","repo":"alibaba/spring-ai-alibaba","slug":"the-current-mode-does-not-support-studio-s-knowled","errorCode":null,"errorMessage":"The current mode does not support Studio's knowledge retrieval node code generation. Please start the complete StudioApplication class","messagePattern":"The current mode does not support Studio's knowledge retrieval node code generation\\. Please start the complete StudioApplication class","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/generator/workflow/sections/KnowledgeRetrievalNodeSection.java","lineNumber":70,"sourceCode":"\n\t// 用于获取Studio存储的文档\n\tprivate final DocumentService studioDocumentService;\n\n\tprivate final String studioStoragePath;\n\n\tpublic KnowledgeRetrievalNodeSection(@Autowired(required = false) DocumentService studioDocumentService,\n\t\t\t@Autowired(required = false) StudioProperties properties) {\n\t\tthis.studioDocumentService = studioDocumentService;\n\t\tthis.studioStoragePath = properties != null ? properties.getStoragePath() : null;\n\t}\n\n\t@Override\n\tpublic String render(Node node, String varName) {\n\t\tKnowledgeRetrievalNodeData nodeData = (KnowledgeRetrievalNodeData) node.getData();\n\n\t\tif (DSLDialectType.STUDIO.equals(nodeData.getDialectType())) {\n\t\t\tif (this.studioDocumentService == null || this.studioStoragePath == null) {\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\"The current mode does not support Studio's knowledge retrieval node code generation. Please start the complete StudioApplication class\");\n\t\t\t}\n\t\t\t// 根据knowledgeBaseIds获取对应的资源文件\n\t\t\tList<ResourceFile> resourceFiles = Optional.ofNullable(nodeData.getKnowledgeBaseIds())\n\t\t\t\t.orElse(List.of())\n\t\t\t\t.stream()\n\t\t\t\t.map(kbId -> {\n\t\t\t\t\tPagingList<Document> getSize = this.studioDocumentService.listDocuments(kbId, new DocumentQuery());\n\t\t\t\t\tLong total = getSize.getTotal();\n\t\t\t\t\tDocumentQuery query = new DocumentQuery();\n\t\t\t\t\tquery.setSize(total.intValue());\n\t\t\t\t\tPagingList<Document> pagingList = this.studioDocumentService.listDocuments(kbId, query);\n\t\t\t\t\treturn pagingList.getRecords();\n\t\t\t\t})\n\t\t\t\t.flatMap(List::stream)\n\t\t\t\t.filter(Document::getEnabled)\n\t\t\t\t.filter(d -> StringUtils.hasText(d.getPath()))\n\t\t\t\t.map(document -> {","sourceCodeStart":52,"sourceCodeEnd":88,"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/generator/workflow/sections/KnowledgeRetrievalNodeSection.java#L52-L88","documentation":"KnowledgeRetrievalNodeSection.render requires studioDocumentService and studioStoragePath when generating code for a STUDIO-dialect knowledge retrieval node. When running a partial/test application where these beans/fields are null, it throws IllegalArgumentException telling the user to start the full StudioApplication class. Studio knowledge retrieval needs document storage access that only the complete application provides.","triggerScenarios":"Calling render on a KnowledgeRetrieval node with dialectType == DSLDialectType.STUDIO while studioDocumentService == null or studioStoragePath == null (e.g. generator used in a stripped-down main or unit test without the Studio beans wired).","commonSituations":"Running project generation from a minimal runner/test context instead of StudioApplication; beans conditionally not loaded due to missing profiles or component scan scope; storage path property not set in application config.","solutions":["Start the generator via the complete StudioApplication class as the message instructs.","Verify the studioDocumentService bean is registered and studioStoragePath property is set in the active configuration.","For STUDIO-dialect workflows in tests, mock/stub studioDocumentService and studioStoragePath, or switch the dialect to a non-STUDIO mode."],"exampleFix":"// before\nSpringApplication.run(SomeMinimalRunner.class);\n// after\nSpringApplication.run(StudioApplication.class); // full app wires DocumentService + storage path","handlingStrategy":"validation","validationCode":"if (dialectType == DSLDialectType.STUDIO &&\n    (studioDocumentService == null || studioStoragePath == null))\n    throw new IllegalStateException(\"Start StudioApplication or provide DocumentService + storagePath\");","typeGuard":null,"tryCatchPattern":"try { generator.generate(spec); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"StudioApplication\")) { /* relaunch with full app context */ } throw e; }","preventionTips":["Run all STUDIO-dialect generation through the full StudioApplication entry point","Check that studioDocumentService and studioStoragePath beans/properties load in the active profile","Avoid testing STUDIO knowledge nodes in stripped-down contexts"],"tags":["configuration","knowledge-retrieval","missing-bean"],"backgroundTag":"missing-required-config","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"}