alibaba/spring-ai-alibaba · error · BizException
APP_NOT_FOUND
APP_NOT_FOUND
Error message
App can not be found.
What it means
Thrown when detailByAppId finds a published AppComponent for the appId, but appService.getApp(appId) returns null for the corresponding Application. It indicates the appId references a component whose underlying application no longer exists (or was never visible), so the detail cannot be assembled.
Source
Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/controller/AppComponentController.java:316
@GetMapping("/{appId}/detail-by-appid")
public Result<AppComponent> detailByAppId(@PathVariable("appId") String appId) {
RequestContext context = RequestContextHolder.getRequestContext();
if (StringUtils.isBlank(appId)) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("appId"));
}
try {
AppComponent appComponentByAppId = appComponentService.getAppComponentByAppId(appId,
AppComponentStatusEnum.Published.getCode());
if (appComponentByAppId == null) {
return Result.success(context.getRequestId(), null);
}
// get component inputScheme
AppComponentConfig appComponentConfig = appComponentManager.getAppComponentInputConfig(appComponentByAppId);
Application application = appService.getApp(appId);
if (application == null) {
throw new BizException(ErrorCode.APP_NOT_FOUND.toError());
}
// get application inputScheme
AppComponentConfig applicationInputConfig = appComponentManager.getApplicationInputConfig(application,
false);
// merge component config
applicationInputConfig = appComponentManager.mergeConfig(applicationInputConfig, appComponentConfig);
appComponentByAppId.setConfig(JsonUtils.toJson(applicationInputConfig));
return Result.success(appComponentByAppId);
}
catch (Exception exception) {
throw new BizException(ErrorCode.APP_COMPONENT_DETAIL_ERROR.toError());
}
}
/**
* Queries components that reference a specific component.View on GitHub (pinned to f82da0b50f)
Solutions
- Verify the appId exists via the app list/detail API before querying the component detail
- Check whether the application was deleted; clean up or republish the orphaned AppComponent
- Confirm you are using the appId (not the component code) and that workspace/tenant context matches
- Inspect appService.getApp and the underlying application table for the given appId
Example fix
// before GET /appComponent/component-code/detail-by-appid // wrong identifier // after GET /appComponent/app-xxxx/detail-by-appid // use the application's appId
Defensive patterns
Strategy: validation
Validate before calling
const app = await appApi.getApp(appId); if (!app) throw new Error(`Application ${appId} not found`); Type guard
const appExists = (app) => app !== null && typeof app === 'object' && Boolean(app.appId);
Try / catch
try { ... } catch (e) { if (e.code === 'APP_NOT_FOUND') { /* refresh app list / restore app */ } else throw e; } Prevention
- Resolve the appId from the application list API, not from stale caches
- Keep component rows and applications in sync on deletion
- Verify tenant/workspace context matches the appId's owner
When it happens
Trigger: GET /appComponent/{appId}/detail-by-appid with an appId that has a published app_component row but no matching application record, or calling with an appId the current user/tenant cannot see.
Common situations: Application deleted while its component row remains; calling with the component's code instead of the application's appId; wrong workspace/namespace or tenant context; stale cached IDs.
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/c9976b59a2d765d8.
Report an issue: GitHub.