iflytek/astron-agent · error · BusinessException

MODEL_NOT_EXIST

MODEL_NOT_EXIST

Error message

MODEL_NOT_EXIST

What it means

Thrown in BotChatServiceImpl.getModelConfiguration when modelService.getRuntimeModelDetail(modelId, uid, spaceId) returns null. It wraps ResponseEnum.MODEL_NOT_EXIST, meaning no runtime model detail exists for the given modelId in that user/space context.

Solutions

  1. Verify the modelId exists and is published to runtime for that uid/spaceId via the model management API.
  2. Re-open the bot configuration and pick a currently available model, then save.
  3. Check whether the model was deleted or unpublished recently (audit logs).
  4. Ensure the request's spaceId matches the space where the model is defined.

Example fix

// before
LLMInfoVo llmInfoVo = modelService.getRuntimeModelDetail(modelId, uid, spaceId);
if (llmInfoVo == null) {
    throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST);
}
// after
LLMInfoVo llmInfoVo = modelService.getRuntimeModelDetail(modelId, uid, spaceId);
if (llmInfoVo == null) {
    log.error("Model not found, modelId: {}, uid: {}, spaceId: {}", modelId, uid, spaceId);
    throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST);
}
Defensive patterns

Strategy: validation

Validate before calling

// Check the model exists and is published before invoking chat:
LLMInfoVo vo = modelService.getRuntimeModelDetail(modelId, uid, spaceId);
if (vo == null) { throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST); }

Try / catch

try {
    botChatService.debugChatMessageBot(request, sseEmitter);
} catch (BusinessException e) {
    if (ResponseEnum.MODEL_NOT_EXIST == e.getCode()) {
        // fall back to a default space model or ask user to reconfigure
    }
}

Prevention

When it happens

Trigger: resolveChatModelConfiguration -> getModelConfiguration(modelId, uid, spaceId, sseEmitter); getRuntimeModelDetail returns null when the modelId is unknown, deleted, not published to runtime, or not visible to uid/spaceId, triggering BusinessException(MODEL_NOT_EXIST).

Common situations: Bot configuration references a model deleted or unpublished by an admin; stale modelId cached in bot config after migration; cross-space copy of a bot with a space-local model; typo in modelId in API call.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/0252922ef18b4455. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/chat/impl/BotChatServiceImpl.java:331

        // Add assistant to user's chat_bot_list
        if (!Objects.equals(botBase.getUid(), uid)) {
            botService.addV2Bot(uid, botId);
        }

        return chatListCreateResponse;
    }

    /**
     * Get model configuration and extract max input tokens
     *
     * @param modelId Model ID
     * @param sseEmitter SSE emitter for error handling
     * @return ModelConfigResult containing LLMInfoVo and maxInputTokens, or null if model doesn't exist
     */
    private ModelConfigResult getModelConfiguration(Long modelId, String uid, Long spaceId, SseEmitter sseEmitter) {
        LLMInfoVo llmInfoVo = modelService.getRuntimeModelDetail(modelId, uid, spaceId);
        if (llmInfoVo == null) {
            throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST);
        }
        return buildModelConfigResult(llmInfoVo);
    }

    private ModelConfigResult resolveChatModelConfiguration(
            Long modelId, String model, String uid, Long spaceId, SseEmitter sseEmitter) {
        if (modelId != null) {
            return getModelConfiguration(modelId, uid, spaceId, sseEmitter);
        }
        if (isSparkModel(model)) {
            return null;
        }
        return getModelConfigurationByDomain(model, uid, spaceId, sseEmitter);
    }

    private ModelConfigResult getModelConfigurationByDomain(
            String modelDomain, String uid, Long spaceId, SseEmitter sseEmitter) {
        ModelDto modelDto = new ModelDto();

View on GitHub (pinned to 5e758547a8)