{"record":{"id":"86361a11d6e91ab7","repo":"alibaba/spring-ai-alibaba","slug":"appconfignotfound","errorCode":"AppConfigNotFound","errorMessage":"App config can not be found.","messagePattern":"App config can not be found\\.","errorType":"error_code","errorClass":"BizException","httpStatus":404,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/AgentServiceImpl.java","lineNumber":168,"sourceCode":"\t\t\tif (CollectionUtils.isEmpty(request.getMessages())) {\n\t\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"messages\"));\n\t\t\t}\n\n\t\t\tif (Objects.isNull(context.getWorkspaceId())) {\n\t\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"workspace_id\"));\n\t\t\t}\n\n\t\t\t// get app config\n\t\t\tApplication app = appService.getApp(appId);\n\t\t\tif (app == null) {\n\t\t\t\tthrow new BizException(ErrorCode.APP_NOT_FOUND.toError());\n\t\t\t}\n\n\t\t\tString configStr;\n\t\t\tif (request.isDraft()) {\n\t\t\t\tconfigStr = app.getConfigStr();\n\t\t\t\tif (configStr == null) {\n\t\t\t\t\tthrow new BizException(ErrorCode.APP_CONFIG_NOT_FOUND.toError());\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconfigStr = app.getPubConfigStr();\n\t\t\t\tif (configStr == null) {\n\t\t\t\t\tthrow new BizException(ErrorCode.APP_NOT_PUBLISHED.toError());\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcontext.setAppType(app.getType());\n\t\t\tcontext.setConfig(JsonUtils.fromJson(configStr, AgentConfig.class));\n\n\t\t\tboolean memoryEnabled = memoryEnabled(context, request);\n\t\t\tcontext.setMemoryEnabled(memoryEnabled);\n\n\t\t\tif (StringUtils.isBlank(request.getConversationId())) {\n\t\t\t\trequest.setConversationId(IdGenerator.idStr());\n\t\t\t}","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/AgentServiceImpl.java#L150-L186","documentation":"BizException (APP_CONFIG_NOT_FOUND) thrown by AgentServiceImpl.checkAndInitContext when request.isDraft() is true but the Application's stored draft config (configStr) is null. A draft-mode call requires a saved draft configuration.","triggerScenarios":"Calling call/streamCall with draft=true on an app that has no draft config persisted (never saved as draft, or draft wiped).","commonSituations":"Testing a brand-new app before ever saving its draft; draft cleared after a migration; requesting draft mode by default when the caller actually wanted the published version.","solutions":["Save a draft of the app configuration in the platform so configStr is populated.","If you intended the live app, set draft=false to read pubConfigStr instead.","Re-publish or re-save the app config if a migration removed the draft."],"exampleFix":"// before\nAgentRequest request = new AgentRequest();\nrequest.setAppId(appId);\nrequest.setDraft(true); // app has no saved draft\n// after\nAgentRequest request = new AgentRequest();\nrequest.setAppId(appId);\nrequest.setDraft(false); // use published config","handlingStrategy":"validation","validationCode":"Application app = appService.getApp(appId);\nif (request.isDraft() && (app == null || app.getConfigStr() == null)) {\n    throw new IllegalStateException(\"App has no saved draft config; publish or save a draft first\");\n}","typeGuard":"boolean hasDraftConfig(Application app) {\n    return app != null && app.getConfigStr() != null;\n}","tryCatchPattern":"try {\n    agentService.call(request, context);\n} catch (BizException e) {\n    if (e.getMessage().contains(\"App config can not be found\")) {\n        // fall back to published config (draft=false)\n    }\n}","preventionTips":["Save a draft immediately after creating an app.","Default integrations to published mode unless actively testing drafts.","Detect null draft config in UI before enabling draft-mode calls."],"tags":["not-found","app-config","draft"],"backgroundTag":"missing-required-config-field","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"}