alibaba/spring-ai-alibaba · error · BizException

APP_COMPONENT_DELETE_ERROR

APP_COMPONENT_DELETE_ERROR

Error message

Failed to delete component.

What it means

BizException thrown by AppComponentController.deleteComponent when appComponentService.deleteAppComponent returns a non-success Result. The request was well-formed but the deletion failed in the service/persistence layer (record missing, FK constraints, internal error).

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

	/**
	 * Deletes an application component. Removes a component from the system by its unique
	 * code.
	 * @param code Unique code of the component to delete
	 * @return Result containing boolean indicating successful deletion
	 */
	@DeleteMapping("/{code}")
	public Result<Boolean> deleteComponent(@PathVariable("code") String code) {
		RequestContext context = RequestContextHolder.getRequestContext();
		if (StringUtils.isBlank(code)) {
			throw new BizException(ErrorCode.MISSING_PARAMS.toError("code"));
		}
		Result<Void> voidResult = appComponentService.deleteAppComponent(code);
		if (voidResult.isSuccess()) {
			return Result.success(context.getRequestId(), true);
		}
		else {
			throw new BizException(ErrorCode.APP_COMPONENT_DELETE_ERROR.toError());
		}
	}

	/**
	 * Retrieves detailed information about a component by its unique code. Includes
	 * merged configuration from both component and source application.
	 * @param code Unique code of the component
	 * @return Result containing detailed AppComponent information with merged
	 * configuration
	 */
	@GetMapping("/{code}/detail-by-code")
	public Result<AppComponent> detailByCode(@PathVariable("code") String code) {

		RequestContext context = RequestContextHolder.getRequestContext();
		if (StringUtils.isBlank(code)) {
			throw new BizException(ErrorCode.MISSING_PARAMS.toError("code"));
		}
		try {

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Check server logs for the underlying cause logged by the service before this exception.
  2. Verify the component with that code still exists before deleting (idempotent handling on the client).
  3. Remove or cascade references to the component that block deletion.
  4. Confirm database connectivity and schema state, then retry.

Example fix

// before
Result<Void> r = appComponentService.deleteAppComponent(code);
if (!r.isSuccess()) throw new BizException(ErrorCode.APP_COMPONENT_DELETE_ERROR.toError());
// after: treat not-found as idempotent success
AppComponent existing = appComponentService.getAppComponentByCode(code, null);
if (existing == null) return Result.success(context.getRequestId(), true);
Result<Void> r2 = appComponentService.deleteAppComponent(code);
if (!r2.isSuccess()) throw new BizException(ErrorCode.APP_COMPONENT_DELETE_ERROR.toError());
Defensive patterns

Strategy: try-catch

Validate before calling

const existing = await api.getComponentByCode(code);
if (!existing) return true; // already gone, treat delete as idempotent success

Type guard

boolean isDeletable(AppComponent c) { return c != null && StringUtils.isNotBlank(c.getCode()); }

Try / catch

try {
  const res = await api.deleteComponent(code);
  if (!res.isSuccess) throw new BizError('APP_COMPONENT_DELETE_ERROR', res);
} catch (e) {
  if (e.code === 'APP_COMPONENT_DELETE_ERROR') {
    // check dependencies/references, then retry or surface to user
  }
}

Prevention

When it happens

Trigger: DELETE /{code} with a valid non-blank code that the service cannot delete: component code not found, dependent records referencing the component, or a database failure surfaced as an error Result.

Common situations: Deleting an already-deleted component; foreign-key constraints from apps referencing the component; DB connectivity issues.

Related errors


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