{"record":{"id":"0252922ef18b4455","repo":"iflytek/astron-agent","slug":"model-not-exist","errorCode":"MODEL_NOT_EXIST","errorMessage":"MODEL_NOT_EXIST","messagePattern":"MODEL_NOT_EXIST","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/chat/impl/BotChatServiceImpl.java","lineNumber":331,"sourceCode":"        // Add assistant to user's chat_bot_list\n        if (!Objects.equals(botBase.getUid(), uid)) {\n            botService.addV2Bot(uid, botId);\n        }\n\n        return chatListCreateResponse;\n    }\n\n    /**\n     * Get model configuration and extract max input tokens\n     *\n     * @param modelId Model ID\n     * @param sseEmitter SSE emitter for error handling\n     * @return ModelConfigResult containing LLMInfoVo and maxInputTokens, or null if model doesn't exist\n     */\n    private ModelConfigResult getModelConfiguration(Long modelId, String uid, Long spaceId, SseEmitter sseEmitter) {\n        LLMInfoVo llmInfoVo = modelService.getRuntimeModelDetail(modelId, uid, spaceId);\n        if (llmInfoVo == null) {\n            throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST);\n        }\n        return buildModelConfigResult(llmInfoVo);\n    }\n\n    private ModelConfigResult resolveChatModelConfiguration(\n            Long modelId, String model, String uid, Long spaceId, SseEmitter sseEmitter) {\n        if (modelId != null) {\n            return getModelConfiguration(modelId, uid, spaceId, sseEmitter);\n        }\n        if (isSparkModel(model)) {\n            return null;\n        }\n        return getModelConfigurationByDomain(model, uid, spaceId, sseEmitter);\n    }\n\n    private ModelConfigResult getModelConfigurationByDomain(\n            String modelDomain, String uid, Long spaceId, SseEmitter sseEmitter) {\n        ModelDto modelDto = new ModelDto();","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/chat/impl/BotChatServiceImpl.java#L313-L349","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the modelId exists and is published to runtime for that uid/spaceId via the model management API.","Re-open the bot configuration and pick a currently available model, then save.","Check whether the model was deleted or unpublished recently (audit logs).","Ensure the request's spaceId matches the space where the model is defined."],"exampleFix":"// before\nLLMInfoVo llmInfoVo = modelService.getRuntimeModelDetail(modelId, uid, spaceId);\nif (llmInfoVo == null) {\n    throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST);\n}\n// after\nLLMInfoVo llmInfoVo = modelService.getRuntimeModelDetail(modelId, uid, spaceId);\nif (llmInfoVo == null) {\n    log.error(\"Model not found, modelId: {}, uid: {}, spaceId: {}\", modelId, uid, spaceId);\n    throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST);\n}","handlingStrategy":"validation","validationCode":"// Check the model exists and is published before invoking chat:\nLLMInfoVo vo = modelService.getRuntimeModelDetail(modelId, uid, spaceId);\nif (vo == null) { throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST); }","typeGuard":null,"tryCatchPattern":"try {\n    botChatService.debugChatMessageBot(request, sseEmitter);\n} catch (BusinessException e) {\n    if (ResponseEnum.MODEL_NOT_EXIST == e.getCode()) {\n        // fall back to a default space model or ask user to reconfigure\n    }\n}","preventionTips":["Clean up bot configurations when models are deleted or unpublished.","Never hard-code modelIds; resolve them from current space inventory.","Validate modelId against the target space on every bot save."],"tags":["model-not-found","chat","configuration","llm"],"backgroundTag":"entity-not-found","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}