alibaba/spring-ai-alibaba · error · BizException

CreateAppError

CreateAppError

Error message

Failed to create app.

What it means

BizException with code CreateAppError thrown by AppServiceImpl.createApp's catch-all for any non-BizException failure during app creation (e.g. DB insert failure via mapper, id generation, cache write). It wraps the original exception as the cause, so the underlying problem is preserved.

Source

Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/AppServiceImpl.java:143

			versionEntity.setModifier(context.getAccountId());

			String config = JsonUtils.toJson(application.getConfig());
			versionEntity.setConfig(config);
			appVersionMapper.insert(versionEntity);

			// update application version
			entity.setLatestVersion(versionEntity);

			String key = getApplicationCacheKey(entity.getWorkspaceId(), entity.getAppId());
			redisManager.put(key, entity);

			return appId;
		}
		catch (BizException e) {
			throw e;
		}
		catch (Exception e) {
			throw new BizException(ErrorCode.CREATE_APP_ERROR.toError(), e);
		}
	}

	/**
	 * Updates an existing application. Creates new version if application is published
	 * @param application Updated application details
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void updateApp(Application application) {
		try {
			RequestContext context = RequestContextHolder.getRequestContext();

			AppEntity entity = getAppById(context.getWorkspaceId(), application.getAppId());
			if (entity == null) {
				throw new BizException(ErrorCode.APP_NOT_FOUND.toError());
			}

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Inspect the wrapped cause (BizException.getCause()) to find the real failure (DB, cache, mapping).
  2. Verify database connectivity, schema/migrations, and that entity fields satisfy column constraints.
  3. Retry once for transient infra errors only after confirming the app was not partially created.

Example fix

// before
catch (Exception e) { log.error("create failed"); }
// after
try {
    appService.createApp(application);
} catch (BizException e) {
    log.error("createApp failed: {}", e.getMessage(), e.getCause());
}
Defensive patterns

Strategy: try-catch

Validate before calling

// validate fields before create
Assert.hasText(application.getName(), "app name required");
Assert.isTrue(application.getName().length() <= 64, "app name too long for DB column");

Try / catch

try { appService.createApp(application); } catch (BizException e) { log.error("createApp failed, cause={}”, e.getCause()); /* check infra, then retry or abort */ }

Prevention

When it happens

Trigger: Database unavailable or insert fails while persisting the new AppEntity; serialization/conversion failure when copying Application to AppEntity; cache (Redis) errors during creation.

Common situations: DB connection pool exhausted or migrations missing; invalid field values violating DB constraints (too-long names); transient infrastructure outages.

Related errors


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