{"record":{"id":"d6caa3d5c4dc3204","repo":"jd-opensource/joyagent-jdgenie","slug":"error-d6caa3","errorCode":null,"errorMessage":"不支持的模型类型","messagePattern":"不支持的模型类型","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"genie-backend/src/main/java/com/jd/genie/service/ColumnValueSyncService.java","lineNumber":54,"sourceCode":"    @Autowired\n    JdbcDataProvider jdbcDataProvider;\n\n    public void initColumnValueIndex() {\n        if (ESUtil.isExistsIndex(dataAgentEsClient, DataAgentConstants.COLUMN_VALUE_ES_INDEX)) {\n            log.info(\"es index 已存在，无需创建\");\n            return;\n        }\n        log.info(\"es index 不存在，开始创建\");\n        ESUtil.createIndex(dataAgentEsClient, DataAgentConstants.COLUMN_VALUE_ES_INDEX, DataAgentConstants.COLUMN_VALUE_ES_MAPPING);\n    }\n\n    public String getTableName(ChatModelInfo modelInfo) {\n        if (\"table\".equalsIgnoreCase(modelInfo.getType())) {\n            return modelInfo.getContent();\n        } else if (\"sql\".equalsIgnoreCase(modelInfo.getType())) {\n            return \"(\" + modelInfo.getContent() + \") t\";\n        } else {\n            throw new RuntimeException(\"不支持的模型类型\" + modelInfo.getType());\n        }\n    }\n\n    public void syncColumnValueBatch(ChatModelInfo modelInfo, List<ChatModelSchema> chatModelSchemas) throws SQLException {\n        if (CollectionUtils.isEmpty(chatModelSchemas)) {\n            log.info(\"没有需要同步的字段值\");\n            return;\n        }\n        for (ChatModelSchema chatModelSchema : chatModelSchemas) {\n            syncColumnValue(modelInfo, chatModelSchema);\n        }\n    }\n\n\n    public void syncColumnValue(ChatModelInfo modelInfo, ChatModelSchema column) throws SQLException {\n        String tableName = getTableName(modelInfo);\n        String valueSql = String.format(\"select %s as `value` FROM %s WHERE %s IS NOT NULL GROUP BY %s Limit  10000\", column.getColumnId(), tableName, column.getColumnId(), column.getColumnId());\n        JdbcQueryRequest jdbcQueryRequest = new JdbcQueryRequest();","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/jd-opensource/joyagent-jdgenie/blob/2417e0b8b636d941ad5fb14c59b20dddfef5375d/genie-backend/src/main/java/com/jd/genie/service/ColumnValueSyncService.java#L36-L72","documentation":"ColumnValueSyncService.getTableName() resolves the physical table name (or a derived subquery alias) from a ChatModelInfo's type. Only 'table' and 'sql' are accepted; any other type throws this RuntimeException, so column-value synchronization cannot proceed for that model.","triggerScenarios":"Calling getTableName() (via tableName) or syncColumnValueBatch flows with a ChatModelInfo whose type is not 'table' or 'sql'.","commonSituations":"ChatModelInfo records seeded with an unexpected type in the model management UI/DB; type field left null; inconsistent types between ChatModelInfo (this service) and DataAgentModelConfig (ChatModelInfoService).","solutions":["Set the ChatModelInfo type to 'table' or 'sql' before syncing","Query the model record and correct its type field","Align type values with the two branches handled here; log the model id in the message for diagnosis"],"exampleFix":"// before\nthrow new RuntimeException(\"不支持的模型类型\" + modelInfo.getType());\n// after\nthrow new RuntimeException(\"不支持的模型类型[\" + modelInfo.getType() + \"], modelId=\" + modelInfo.getId() + \", 仅支持 table/sql\");","handlingStrategy":"validation","validationCode":"String type = modelInfo.getType();\nif (!\"table\".equalsIgnoreCase(type) && !\"sql\".equalsIgnoreCase(type)) {\n    throw new IllegalArgumentException(\"unsupported model type: \" + type);\n}\nString tableName = syncService.getTableName(modelInfo);","typeGuard":null,"tryCatchPattern":"try {\n    String t = syncService.getTableName(modelInfo);\n} catch (RuntimeException e) {\n    log.warn(\"skip sync, bad model type: {}\", e.getMessage());\n}","preventionTips":["Use the same type enum across ChatModelInfo and DataAgentModelConfig","Reject unknown types when saving ChatModelInfo","Log model id in errors to locate bad records quickly"],"tags":["configuration","unsupported-type","sync"],"backgroundTag":"unsupported-enum-value","analyzedSha":"2417e0b8b636d941ad5fb14c59b20dddfef5375d","analyzedAt":"2026-09-08T11:28:19.414Z","contentChangedAt":"2026-09-08T11:28:19.414Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}