alibaba/spring-ai-alibaba · error · BizException
AppNotPublished
AppNotPublished
Error message
App has not published yet.
What it means
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.
Source
Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/AgentServiceImpl.java:174
}
// get app config
Application app = appService.getApp(appId);
if (app == null) {
throw new BizException(ErrorCode.APP_NOT_FOUND.toError());
}
String configStr;
if (request.isDraft()) {
configStr = app.getConfigStr();
if (configStr == null) {
throw new BizException(ErrorCode.APP_CONFIG_NOT_FOUND.toError());
}
}
else {
configStr = app.getPubConfigStr();
if (configStr == null) {
throw new BizException(ErrorCode.APP_NOT_PUBLISHED.toError());
}
}
context.setAppType(app.getType());
context.setConfig(JsonUtils.fromJson(configStr, AgentConfig.class));
boolean memoryEnabled = memoryEnabled(context, request);
context.setMemoryEnabled(memoryEnabled);
if (StringUtils.isBlank(request.getConversationId())) {
request.setConversationId(IdGenerator.idStr());
}
context.setAppId(appId);
context.setConversationId(request.getConversationId());
context.setRequest(request);
context.setSource(context.getSource());
LogUtils.monitor(context, "AgentService", "check", start, SUCCESS, request, null);View on GitHub (pinned to f82da0b50f)
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.
Example fix
// before
// app never published, calling in live mode
curl -d '{"appId":"app-1","draft":false,...}' /api/agent/call
// after
// publish the app first, or test draft:
curl -d '{"appId":"app-1","draft":true,...}' /api/agent/call Defensive patterns
Strategy: fallback
Validate before calling
Application app = appService.getApp(appId);
if (!request.isDraft() && (app == null || app.getPubConfigStr() == null)) {
throw new IllegalStateException("App is not published: " + appId);
} Type guard
boolean isPublished(Application app) {
return app != null && app.getPubConfigStr() != null;
} Try / catch
try {
agentService.call(request, context);
} catch (BizException e) {
if (e.getMessage().contains("not published")) {
// fall back to draft call or return a clear 'publish first' message
}
} Prevention
- 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.
When it happens
Trigger: Calling call/streamCall with draft=false on an app that has never been published (or whose publication was removed).
Common situations: Integrating against a freshly created app before clicking Publish; app edited and unpublished; CI environments pointing at unpublished apps.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- AppNotFound
- Invalid status:
- Cannot create update map after mergeAll() has been called
- mergeAll() can only be called once
- Shell session not initialized. Call initialize() before exec
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/ffea05f3766a9c51.
Report an issue: GitHub.