alibaba/spring-ai-alibaba · error · BizException

AppConfigNotFound

AppConfigNotFound

Error message

App config can not be found.

What it means

BizException (APP_CONFIG_NOT_FOUND) thrown by AgentServiceImpl.checkAndInitContext when request.isDraft() is true but the Application's stored draft config (configStr) is null. A draft-mode call requires a saved draft configuration.

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/AgentServiceImpl.java:168

			if (CollectionUtils.isEmpty(request.getMessages())) {
				throw new BizException(ErrorCode.MISSING_PARAMS.toError("messages"));
			}

			if (Objects.isNull(context.getWorkspaceId())) {
				throw new BizException(ErrorCode.MISSING_PARAMS.toError("workspace_id"));
			}

			// get app config
			Application app = appService.getApp(appId);
			if (app == null) {
				throw new BizException(ErrorCode.APP_NOT_FOUND.toError());
			}

			String configStr;
			if (request.isDraft()) {
				configStr = app.getConfigStr();
				if (configStr == null) {
					throw new BizException(ErrorCode.APP_CONFIG_NOT_FOUND.toError());
				}
			}
			else {
				configStr = app.getPubConfigStr();
				if (configStr == null) {
					throw new BizException(ErrorCode.APP_NOT_PUBLISHED.toError());
				}
			}

			context.setAppType(app.getType());
			context.setConfig(JsonUtils.fromJson(configStr, AgentConfig.class));

			boolean memoryEnabled = memoryEnabled(context, request);
			context.setMemoryEnabled(memoryEnabled);

			if (StringUtils.isBlank(request.getConversationId())) {
				request.setConversationId(IdGenerator.idStr());
			}

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Save a draft of the app configuration in the platform so configStr is populated.
  2. If you intended the live app, set draft=false to read pubConfigStr instead.
  3. Re-publish or re-save the app config if a migration removed the draft.

Example fix

// before
AgentRequest request = new AgentRequest();
request.setAppId(appId);
request.setDraft(true); // app has no saved draft
// after
AgentRequest request = new AgentRequest();
request.setAppId(appId);
request.setDraft(false); // use published config
Defensive patterns

Strategy: validation

Validate before calling

Application app = appService.getApp(appId);
if (request.isDraft() && (app == null || app.getConfigStr() == null)) {
    throw new IllegalStateException("App has no saved draft config; publish or save a draft first");
}

Type guard

boolean hasDraftConfig(Application app) {
    return app != null && app.getConfigStr() != null;
}

Try / catch

try {
    agentService.call(request, context);
} catch (BizException e) {
    if (e.getMessage().contains("App config can not be found")) {
        // fall back to published config (draft=false)
    }
}

Prevention

When it happens

Trigger: Calling call/streamCall with draft=true on an app that has no draft config persisted (never saved as draft, or draft wiped).

Common situations: Testing a brand-new app before ever saving its draft; draft cleared after a migration; requesting draft mode by default when the caller actually wanted the published version.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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