alibaba/spring-ai-alibaba · error · BizException

APP_COMPONENT_REFER_ERROR

APP_COMPONENT_REFER_ERROR

Error message

Failed to query reference of component.

What it means

A catch-all BizException from queryReferInfo: any exception while fetching references via referService.getReferListByReferCode or building the AppComponent DTO list is converted to ErrorCode.APP_COMPONENT_REFER_ERROR. The root cause is not surfaced in the response.

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:366

			List<Refer> refers = referService.getReferListByReferCode(code);
			if (!CollectionUtils.isEmpty(refers)) {
				for (Refer refer : refers) {
					Application application = appService.getApp(refer.getMainCode());
					if (application == null || application.getStatus() == AppStatus.DELETED) {
						continue;
					}
					AppComponent appComponent = new AppComponent();
					appComponent.setAppId(application.getAppId());
					appComponent.setName(application.getName());
					AppType type = application.getType();
					appComponent.setType(type.getValue());
					appComponentDTOList.add(appComponent);
				}
			}
			return Result.success(context.getRequestId(), appComponentDTOList);
		}
		catch (Exception exception) {
			throw new BizException(ErrorCode.APP_COMPONENT_REFER_ERROR.toError());
		}

	}

	/**
	 * Queries the configuration of a component by its application ID.
	 * @param appId Application ID associated with the component
	 * @return Result containing the component's configuration details
	 */
	@GetMapping("/{appId}/query-config")
	public Result<AppComponent> queryConfig(@PathVariable("appId") String appId) {
		RequestContext context = RequestContextHolder.getRequestContext();
		if (StringUtils.isBlank(appId)) {
			throw new BizException(ErrorCode.MISSING_PARAMS.toError("appId"));
		}
		try {
			Application application = appService.getApp(appId);
			if (application == null) {

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Enable debug logging to capture the swallowed exception inside queryReferInfo
  2. Verify database health and the refer table integrity (no dangling references)
  3. Check that all referenced apps/components still exist and map correctly to AppComponent
  4. Retry if the failure was transient

Example fix

// before
catch (Exception exception) {
    throw new BizException(ErrorCode.APP_COMPONENT_REFER_ERROR.toError());
}
// after
catch (Exception exception) {
    log.error("Failed to query refer info for code={}", code, exception);
    throw new BizException(ErrorCode.APP_COMPONENT_REFER_ERROR.toError());
}
Defensive patterns

Strategy: try-catch

Validate before calling

const resp = await fetch(url); if (!resp.ok) throw new Error(`query-refer failed: ${resp.status}`);

Type guard

null

Try / catch

try { ... } catch (e) { if (e.code === 'APP_COMPONENT_REFER_ERROR') { showGenericErrorAndLog(e); } else throw e; }

Prevention

When it happens

Trigger: Any RuntimeException inside the try block of GET /appComponent/{code}/query-refer — e.g. refer-table query failure, mapping errors when converting Refer rows to AppComponent DTOs.

Common situations: Database connectivity problems; refer records referencing deleted apps/components causing mapping NPEs; schema drift between refer and component tables.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09). Data as JSON: /api/errors/6ac64754badf7552. Report an issue: GitHub.