alibaba/spring-ai-alibaba · error · BizException

APP_COMPONENT_PUBLISH_ERROR

APP_COMPONENT_PUBLISH_ERROR

Error message

Failed to release application as component.

What it means

After passing validation, publishComponent calls appComponentService.createAppComponent(component). If the returned Result is not success (service-level failure such as persistence error or business rule rejection), the controller throws APP_COMPONENT_PUBLISH_ERROR. The cause is hidden from the client; inspect the server logs and the Result message from the service.

Solutions

  1. Check server logs for the failure recorded by createAppComponent and its Result message.
  2. Retry after fixing the data issue (e.g. rename if the component code/name collides with an existing published component).
  3. Verify database health and that component tables are migrated.
  4. Check for duplicate component codes via the component list endpoint before republishing.

Example fix

// before
else {
    throw new BizException(ErrorCode.APP_COMPONENT_PUBLISH_ERROR.toError());
}
// after
else {
    log.error("Publish component failed: {}", appComponent.getMessage());
    throw new BizException(ErrorCode.APP_COMPONENT_PUBLISH_ERROR.toError());
}
Defensive patterns

Strategy: try-catch

Validate before calling

const existing = await api.getComponentList({ keyword: payload.name });
if (existing.data.some(c => c.name === payload.name)) throw new Error('a component with this name may already be published');

Try / catch

try {
  await api.publishComponent(payload);
} catch (e) {
  if (e.code === 'APP_COMPONENT_PUBLISH_ERROR') {
    // inspect server logs / retry after resolving the service-level cause
  } else throw e;
}

Prevention

When it happens

Trigger: POST /appComponent with a fully valid body where appComponentService.createAppComponent returns a failed Result — e.g. duplicate component code, DB insert failure, or internal service error.

Common situations: Component with the same code already exists; database constraint violation; service internal error after upgrade/migration.

Related errors


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

Appendix: 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:181

		}
		if (StringUtils.isBlank(request.getConfig())) {
			throw new BizException(ErrorCode.MISSING_PARAMS.toError("config"));
		}
		if (StringUtils.isBlank(request.getAppId())) {
			throw new BizException(ErrorCode.MISSING_PARAMS.toError("appId"));
		}
		if (StringUtils.isBlank(request.getDescription())) {
			throw new BizException(ErrorCode.MISSING_PARAMS.toError("description"));
		}

		// create component
		AppComponent component = initComponent(request);
		Result<String> appComponent = appComponentService.createAppComponent(component);
		if (appComponent.isSuccess()) {
			return Result.success(context.getRequestId(), appComponent.getData());
		}
		else {
			throw new BizException(ErrorCode.APP_COMPONENT_PUBLISH_ERROR.toError());
		}
	}

	/**
	 * Updates an existing application component. Modifies the configuration and details
	 * of a published component.
	 * @param code Unique code of the component to update
	 * @param request Updated component details including: - type: Component type - name:
	 * Component name - config: Updated configuration - appId: Associated application ID -
	 * description: Updated description
	 * @return Result indicating successful update
	 */
	@PutMapping("/{code}")
	public Result<String> updateComponent(@PathVariable("code") String code, @RequestBody AppComponentQuery request) {
		RequestContext context = RequestContextHolder.getRequestContext();
		request.setCode(code);
		if (Objects.isNull(request.getType())) {
			throw new BizException(ErrorCode.MISSING_PARAMS.toError("type"));

View on GitHub (pinned to f82da0b50f)