alibaba/spring-ai-alibaba · error · BizException

APP_COMPONENT_DETAIL_ERROR

APP_COMPONENT_DETAIL_ERROR

Error message

Failed to query component detail.

What it means

BizException thrown by AppComponentController.detailByCode inside a catch-all when any step of fetching the published component, loading its source application config, or merging configurations throws. It intentionally obscures the root cause behind a generic 'failed to query component detail' message.

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

				return Result.success(context.getRequestId(), null);
			}
			// get component inputScheme
			AppComponentConfig appComponentConfig = appComponentManager.getAppComponentInputConfig(appComponentByCode);
			String appId = appComponentByCode.getAppId();
			Application application = appService.getApp(appId);
			if (application == null) {
				return Result.error(context.getRequestId(), ErrorCode.APP_NOT_FOUND);
			}
			// get application inputScheme
			AppComponentConfig applicationInputConfig = appComponentManager.getApplicationInputConfig(application,
					false);
			// merge component config
			applicationInputConfig = appComponentManager.mergeConfig(applicationInputConfig, appComponentConfig);
			appComponentByCode.setConfig(JsonUtils.toJson(applicationInputConfig));
			return Result.success(context.getRequestId(), appComponentByCode);
		}
		catch (Exception e) {
			throw new BizException(ErrorCode.APP_COMPONENT_DETAIL_ERROR.toError());
		}

	}

	/**
	 * Retrieves detailed information about a component by its application ID. Includes
	 * merged configuration from both component and source application.
	 * @param appId Application ID associated with the component
	 * @return Result containing detailed AppComponent information with merged
	 * configuration
	 */
	@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"));
		}

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Temporarily log the caught exception (or inspect server logs) to identify which step failed — the BizException hides the cause.
  2. Validate that the component's source application still exists and its config is valid JSON.
  3. Check appComponentManager.mergeConfig inputs for null or incompatible config shapes.
  4. Fix the corrupt/missing data, then retry the request.

Example fix

// before
catch (Exception e) {
    throw new BizException(ErrorCode.APP_COMPONENT_DETAIL_ERROR.toError());
}
// after
catch (Exception e) {
    log.error("Failed to query component detail for code={}", code, e);
    throw new BizException(ErrorCode.APP_COMPONENT_DETAIL_ERROR.toError());
}
Defensive patterns

Strategy: try-catch

Validate before calling

const comp = await api.getComponentByCode(code);
if (comp && comp.sourceAppId) await api.getApplication(comp.sourceAppId); // ensure source app exists and config parses
JSON.parse(comp.config); // fail fast on corrupt config before merging

Type guard

function isValidComponentDetail(c) { return c != null && typeof c.code === 'string' && (!c.config || isPlainObject(safeParse(c.config))); }

Try / catch

try {
  const detail = await api.getComponentDetail(code);
} catch (e) {
  if (e.code === 'APP_COMPONENT_DETAIL_ERROR') {
    // inspect server logs for root cause: corrupt config JSON, missing source app, or merge failure
  }
}

Prevention

When it happens

Trigger: GET /{code}/detail-by-code where getAppComponentByCode throws, the referenced source application cannot be loaded/parsed, appComponentManager.mergeConfig fails, or JsonUtils.toJson throws during the merge — any Exception in the try block.

Common situations: Malformed JSON stored in the app or component config column; source application deleted after component creation; merge logic hitting an unexpected config shape; DB errors during lookup.

Related errors


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