{"record":{"id":"f17f6646588bcea1","repo":"iflytek/astron-agent","slug":"response-failed-fine-tuning-model-does-not-exist","errorCode":"RESPONSE_FAILED","errorMessage":"Fine-tuning model does not exist","messagePattern":"Fine-tuning model does 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":588,"sourceCode":"        return ApiResult.success(configs);\n    }\n\n    /**\n     * Whether to enable fine-tuning model\n     *\n     * @param modelId\n     * @param enable\n     */\n    public void switchFinetuneModel(Long modelId, Boolean enable) {\n        final String enabledKey = MODEL_ENABLE_KEY.concat(UserInfoManagerHandler.getUserId());\n        Map<String, Boolean> catchModelMap = getCatchModelMap(enabledKey);\n        if (catchModelMap == null) {\n            catchModelMap = new HashMap<>();\n        }\n        final String key = String.valueOf(modelId);\n        Boolean exists = catchModelMap.get(key);\n        if (exists == null) {\n            throw new BusinessException(ResponseEnum.RESPONSE_FAILED, \"Fine-tuning model does not exist\");\n        } else {\n            catchModelMap.put(modelId.toString(), enable);\n            redisTemplate.opsForValue().set(enabledKey, JSON.toJSONString(catchModelMap));\n        }\n    }\n}\n","sourceCodeStart":570,"sourceCodeEnd":595,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/model/LLMService.java#L570-L595","documentation":"LLMService's fine-tuning enable/update path keeps a cached map (catchModelMap, also persisted in Redis) of known fine-tuning model ids. If the requested modelId is not present in the cache, it throws BusinessException(RESPONSE_FAILED, \"Fine-tuning model does not exist\"): the model was never registered as a fine-tuning model (or the cache was lost/reset).","triggerScenarios":"Toggling/enabling a fine-tuning model by id when catchModelMap has no entry for that id — e.g. after a Redis flush, service restart with empty local cache, or passing a regular (non fine-tuning) model id.","commonSituations":"Redis flushed or evicted the cached map key; environment switch (cache populated in dev, request in prod); caller passing a non-fine-tuning model id; cache population step failed earlier and was ignored.","solutions":["Verify the modelId actually refers to a fine-tuning model","Check the Redis key holding the cached map; if missing, re-trigger the cache population (model list sync) before toggling","Re-sync the fine-tuning model cache from the upstream source and retry","Fix the misleading generic RESPONSE_FAILED enum by using a dedicated not-found enum"],"exampleFix":"// before\nBoolean exists = catchModelMap.get(key);\nif (exists == null) {\n    throw new BusinessException(ResponseEnum.RESPONSE_FAILED, \"Fine-tuning model does not exist\");\n}\n// after\nBoolean exists = catchModelMap.get(key);\nif (exists == null) {\n    refreshFineTuningModelCache(); // re-populate from source before failing\n    exists = catchModelMap.get(key);\n}\nif (exists == null) {\n    throw new BusinessException(ResponseEnum.MODEL_NOT_EXIST, \"Fine-tuning model does not exist: \" + key);\n}","handlingStrategy":"fallback","validationCode":"// check cache membership before toggling\nBoolean known = redisTemplate.opsForValue().get(fineTuningCacheKey) != null;\nif (!known) refreshFineTuningModelCache();","typeGuard":null,"tryCatchPattern":"try {\n    llmService.setFineTuningModelEnabled(modelId, enable);\n} catch (BusinessException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Fine-tuning model does not exist\")) {\n        refreshFineTuningModelCache(); // then retry once\n    }\n}","preventionTips":["Persist and rehydrate the fine-tuning model cache on startup","Avoid Redis flushes in shared environments or re-populate after","Only pass model ids sourced from the fine-tuning model list","Use a dedicated not-found enum instead of RESPONSE_FAILED + message"],"tags":["redis","cache","fine-tuning","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"}