{"record":{"id":"70652b83b503305a","repo":"iflytek/astron-agent","slug":"model-not-exist-businessexception-responseenum","errorCode":"MODEL_NOT_EXIST","errorMessage":"BusinessException(ResponseEnum.MODEL_NOT_EXIST)","messagePattern":"BusinessException\\(ResponseEnum\\.MODEL_NOT_EXIST\\)","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/model/LLMService.java","lineNumber":550,"sourceCode":"                array.add(new JSONObject()\n                        .fluentPut(\"domain\", domain)\n                        .fluentPut(\"channel\", serviceId)\n                        .fluentPut(\"patchId\", patchId));\n            }\n        });\n\n        return array;\n    }\n\n    public Object selfModelConfig(Long id, Integer llmSource) {\n        if (llmSource != 0) {\n            throw new BusinessException(ResponseEnum.NOT_CUSTOM_MODEL);\n        }\n        String uid = UserInfoManagerHandler.getUserId();\n\n        Model one = modelMapper.selectOne(new LambdaQueryWrapper<Model>().eq(Model::getId, id));\n        if (one == null) {\n            throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST);\n        }\n        if (!Objects.equals(uid, one.getUid())) {\n            throw new BusinessException(ResponseEnum.EXCEED_AUTHORITY);\n        }\n        List<Config> configs = JSON.parseArray(one.getConfig(), Config.class);\n        if (CollUtil.isNotEmpty(configs)) {\n            for (Config config : configs) {\n                Float precision = config.getPrecision();\n                if (precision != null) {\n                    // If precision is an integer greater than 1, convert to decimal form, e.g., 1 to 0.1, 2 to 0.01,\n                    // etc.\n                    int intPrec = Math.round(precision);\n                    if (precision >= 1 && Math.abs(precision - intPrec) < 1e-6) {\n                        float newPrec = 1f / (float) Math.pow(10, intPrec);\n                        config.setPrecision(newPrec);\n                    }\n                }\n            }","sourceCodeStart":532,"sourceCodeEnd":568,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/model/LLMService.java#L532-L568","documentation":"In selfModelConfig, after confirming the model is custom, the service queries the model table by id. If no row matches, it throws BusinessException(MODEL_NOT_EXIST): the requested model id does not exist in the database.","triggerScenarios":"Calling selfModelConfig with a model id that is absent from the model table — deleted model, id from another environment/tenant, or a stale id cached in the frontend.","commonSituations":"Model deleted by another user while the page was open; frontend using a hardcoded or stale id; querying across environments (dev id used in prod); id passed as wrong type causing a mismatch.","solutions":["Confirm the model id exists: SELECT * FROM model WHERE id = ?","Refresh the model list in the UI to clear stale ids","Check you are pointing at the intended database/environment","Handle the error client-side by reloading models when MODEL_NOT_EXIST is returned"],"exampleFix":"// before\nllmService.selfModelConfig(1234L, 0); // stale id\n// after\nModel current = modelList.stream().filter(m -> m.getId().equals(1234L)).findFirst()\n    .orElseThrow(() -> new IllegalStateException(\"model 1234 no longer exists, refresh list\"));\nllmService.selfModelConfig(current.getId(), 0);","handlingStrategy":"validation","validationCode":"// verify the model id exists and belongs to the current user before calling\nModel m = modelMapper.selectById(id);\nif (m == null) throw new IllegalStateException(\"model \" + id + \" does not exist\");","typeGuard":null,"tryCatchPattern":"try {\n    llmService.selfModelConfig(id, 0);\n} catch (BusinessException e) {\n    // MODEL_NOT_EXIST: refresh model list in UI and ask user to re-select\n}","preventionTips":["Refresh model lists after deletions; avoid stale ids in clients","Never hardcode model ids across environments","Validate id existence in the controller layer","Listen for model-deleted events to clean client caches"],"tags":["database","record-not-found","llm","java"],"backgroundTag":"record-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"}