{"record":{"id":"ffea05f3766a9c51","repo":"alibaba/spring-ai-alibaba","slug":"appnotpublished","errorCode":"AppNotPublished","errorMessage":"App has not published yet.","messagePattern":"App has not published yet\\.","errorType":"error_code","errorClass":"BizException","httpStatus":400,"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":174,"sourceCode":"\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}\n\n\t\t\tcontext.setAppId(appId);\n\t\t\tcontext.setConversationId(request.getConversationId());\n\t\t\tcontext.setRequest(request);\n\t\t\tcontext.setSource(context.getSource());\n\t\t\tLogUtils.monitor(context, \"AgentService\", \"check\", start, SUCCESS, request, null);","sourceCodeStart":156,"sourceCodeEnd":192,"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#L156-L192","documentation":"BizException (APP_NOT_PUBLISHED) thrown by AgentServiceImpl.checkAndInitContext when draft=false (default) but the Application's published config (pubConfigStr) is null. Non-draft calls execute the published configuration, which does not exist yet.","triggerScenarios":"Calling call/streamCall with draft=false on an app that has never been published (or whose publication was removed).","commonSituations":"Integrating against a freshly created app before clicking Publish; app edited and unpublished; CI environments pointing at unpublished apps.","solutions":["Publish the app in the platform so pubConfigStr is populated.","For pre-production testing use draft=true after saving a draft.","Verify you are calling the right environment/app that has a published version."],"exampleFix":"// before\n// app never published, calling in live mode\ncurl -d '{\"appId\":\"app-1\",\"draft\":false,...}' /api/agent/call\n// after\n// publish the app first, or test draft:\ncurl -d '{\"appId\":\"app-1\",\"draft\":true,...}' /api/agent/call","handlingStrategy":"fallback","validationCode":"Application app = appService.getApp(appId);\nif (!request.isDraft() && (app == null || app.getPubConfigStr() == null)) {\n    throw new IllegalStateException(\"App is not published: \" + appId);\n}","typeGuard":"boolean isPublished(Application app) {\n    return app != null && app.getPubConfigStr() != null;\n}","tryCatchPattern":"try {\n    agentService.call(request, context);\n} catch (BizException e) {\n    if (e.getMessage().contains(\"not published\")) {\n        // fall back to draft call or return a clear 'publish first' message\n    }\n}","preventionTips":["Make publishing part of the release checklist before integration.","Automate publishing in CI after config changes.","Monitor publication status of apps used by production clients."],"tags":["not-published","app","lifecycle"],"backgroundTag":"resource-not-found","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"}