{"record":{"id":"5611d35debbc72a0","repo":"alibaba/spring-ai-alibaba","slug":"error-5611d3","errorCode":null,"errorMessage":"模型配置解析失败: ","messagePattern":"模型配置解析失败: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/utils/ModelConfigParser.java","lineNumber":102,"sourceCode":"                    }\n                }\n                \n                // 3. 如果还是找不到，抛出异常\n                if (modelEntity == null) {\n                    throw new IllegalArgumentException(\"模型配置不存在: modelId=\" + modelConfigInfo.getModelId() + \n                        (modelConfigInfo.getParameter(\"modelName\") != null ? \", modelName=\" + modelConfigInfo.getParameter(\"modelName\") : \"\"));\n                }\n                \n                // 如果从 ModelManager 找到了模型，更新 modelConfigInfo 的 modelId 为 ModelEntity 的 id\n                log.info(\"从 ModelManager 找到模型: id={}, name={}, modelId={}, workspaceId={}\", \n                    modelEntity.getId(), modelEntity.getName(), modelEntity.getModelId(), workspaceId);\n                \n                // 更新 modelId 为 ModelEntity 的 id，确保后续使用正确的 id\n                modelConfigInfo.setModelId(modelEntity.getId());\n            }\n        } catch (Exception e) {\n            log.error(\"解析模型配置失败: modelConfig={}\", modelConfig, e);\n            throw new RuntimeException(\"模型配置解析失败: \" + e.getMessage(), e);\n        }\n        return modelConfigInfo;\n    }\n    \n    /**\n     * 提取模型调用参数 从ModelConfigInfo中获取动态参数并转换格式\n     *\n     * @param modelConfigInfo 模型配置信息对象\n     * @return 模型调用参数Map\n     */\n    public Map<String, Object> extractModelParameters(ModelConfigInfo modelConfigInfo) {\n        if (modelConfigInfo == null) {\n            return new HashMap<>();\n        }\n        \n        Map<String, Object> convertedParameters = new HashMap<>();\n        Map<String, Object> originalParameters = modelConfigInfo.getAllParameters();\n        ","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/utils/ModelConfigParser.java#L84-L120","documentation":"A RuntimeException thrown by ModelConfigParser.checkAndGetModelConfigInfo as a catch-all wrapper: any Exception raised while resolving the model config (JSON parse errors, missing model lookups, unexpected failures) is logged and rethrown as '模型配置解析失败: <cause message>' with the original as the cause. It signals that model config resolution failed for a reason not handled more specifically.","triggerScenarios":"Calling checkAndGetModelConfigInfo when an inner step throws — e.g. parseModelConfig's IllegalArgumentException for empty/bad JSON, the '模型配置不存在' lookup failure, or any unexpected runtime error during ModelManager resolution.","commonSituations":"Malformed stored modelConfig; model missing from the registry; transient DB/registry errors during model lookup; changes to ModelConfigInfo schema making old configs unparseable.","solutions":["Read the cause (e.getCause()) / wrapped message to find the underlying failure and fix that specifically.","Fix or re-save the modelConfig JSON so it parses and references an existing model.","Guard the call site: validate config non-empty and the model exists before calling.","Catch RuntimeException around checkAndGetModelConfigInfo and degrade gracefully (e.g. use a default model)."],"exampleFix":"// before\nModelConfigInfo info = parser.checkAndGetModelConfigInfo(cfg); // wraps any failure\n// after\ntry {\n    ModelConfigInfo info = parser.checkAndGetModelConfigInfo(cfg);\n} catch (RuntimeException e) {\n    log.error(\"model config resolve failed\", e.getCause());\n    throw new BadRequestException(\"Invalid model config: \" + e.getCause().getMessage());\n}","handlingStrategy":"try-catch","validationCode":"if (cfg == null || cfg.isBlank()) throw new BadRequestException(\"modelConfig required\");","typeGuard":"null","tryCatchPattern":"try { return parser.checkAndGetModelConfigInfo(cfg); } catch (RuntimeException e) { Throwable cause = e.getCause(); log.error(\"model config failed\", cause); throw new BadRequestException(String.valueOf(cause)); }","preventionTips":["Always inspect getCause() — this exception wraps the real failure","Pre-validate JSON and model existence to avoid reaching the catch-all","Keep ModelConfigInfo schema and stored configs in sync"],"tags":["model-config","wrapped-exception","resolution-failed"],"backgroundTag":"invalid-config-value","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}