alibaba/spring-ai-alibaba · error · BizException
AppNotFound
AppNotFound
Error message
App can not be found.
What it means
BizException (APP_NOT_FOUND) thrown by AgentServiceImpl.checkAndInitContext when appService.getApp(appId) returns null. The appId passed validation but no Application record exists in the resolved scope.
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:161
}
String appId = request.getAppId();
if (StringUtils.isBlank(appId)) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("appId"));
}
if (CollectionUtils.isEmpty(request.getMessages())) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("messages"));
}
if (Objects.isNull(context.getWorkspaceId())) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("workspace_id"));
}
// 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));View on GitHub (pinned to f82da0b50f)
Solutions
- Verify the appId in the platform console or via the app list API and correct it.
- Confirm the workspace/account context matches the workspace the app belongs to.
- Recreate or re-import the app if it was deleted.
Example fix
// before
request.setAppId("app-9x8y7z"); // deleted app
// after
request.setAppId("app-1a2b3c"); // verified existing app ID Defensive patterns
Strategy: validation
Validate before calling
Application app = appService.getApp(appId);
if (app == null) {
throw new IllegalArgumentException("App not found: " + appId);
} Type guard
boolean appExists(String appId, AppService svc) {
return appId != null && svc.getApp(appId) != null;
} Try / catch
try {
agentService.call(request, context);
} catch (BizException e) {
if (e.getMessage().contains("App can not be found")) {
// refresh app id from catalog, surface 404 to caller
}
} Prevention
- Resolve appIds from the app list API, never freeform text.
- Keep per-environment app id config files to avoid cross-env mistakes.
- Handle app deletion events by invalidating cached ids.
When it happens
Trigger: call/streamCall with a syntactically valid appId that does not match any stored application.
Common situations: App deleted in the console; typo in appId; app belongs to a different workspace/account; environment mismatch (prod app id used against a dev database).
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
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/6c9d6ca748301e20.
Report an issue: GitHub.