{"record":{"id":"a1432575d4fb5a93","repo":"jd-opensource/joyagent-jdgenie","slug":"s-a14325","errorCode":null,"errorMessage":"获取表字段信息失败 %s","messagePattern":"获取表字段信息失败 (.+?)","errorType":"exception","errorClass":"CatalogException","httpStatus":null,"severity":"error","filePath":"genie-backend/src/main/java/com/jd/genie/data/jdbc/catalog/mysql/MySqlCatalog.java","lineNumber":84,"sourceCode":"            List<TableColumn> columnList = new ArrayList<>();\n            while (rs.next()) {\n                String columnName = rs.getString(\"COLUMN_NAME\");\n                String jdbcDataType = rs.getString(\"DATA_TYPE\").toUpperCase();\n                String dataType = typeConvertMysql(jdbcDataType);\n                String comment = rs.getString(\"COLUMN_COMMENT\");\n                TableColumn column = TableColumn.builder().name(columnName)\n                        .comment(comment)\n                        .dataType(dataType)\n                        .originDataType(jdbcDataType)\n                        .nullable(rs.getBoolean(\"Is_NULLABLE\"))\n                        .position(i++)\n                        .build();\n                columnList.add(column);\n            }\n            return columnList;\n\n        } catch (Exception e) {\n            throw new CatalogException(\n                    String.format(\"获取表字段信息失败 %s\", tablePath), e);\n        }\n    }\n}\n","sourceCodeStart":66,"sourceCodeEnd":89,"githubUrl":"https://github.com/jd-opensource/joyagent-jdgenie/blob/2417e0b8b636d941ad5fb14c59b20dddfef5375d/genie-backend/src/main/java/com/jd/genie/data/jdbc/catalog/mysql/MySqlCatalog.java#L66-L89","documentation":"MySqlCatalog.getTableColumns wraps any exception while reading column metadata for a table into CatalogException '获取表字段信息失败 <tablePath>'. The cause contains the underlying SQL error. It indicates column metadata for the given MySQL table could not be fetched.","triggerScenarios":"Calling getTableColumns(tablePath) when the table does not exist, the schema is wrong, or the information_schema query throws an SQLException.","commonSituations":"Typo in schema.table path, table dropped by a migration, connecting to the wrong MySQL instance/environment, or missing privileges on information_schema columns.","solutions":["Verify the table exists in the target schema (listTables first).","Check the tablePath format matches schema.table and identifier casing.","Inspect the wrapped cause SQLException for the MySQL error code.","Grant the connecting user metadata read privileges."],"exampleFix":"// before\ncatalog.getTableColumns(\"orders\"); // missing schema prefix\n// after\ncatalog.getTableColumns(\"shop.orders\");","handlingStrategy":"validation","validationCode":"// Java: verify the table exists before getTableColumns\nList<SimpleTable> tables = mySqlCatalog.listTables(schema);\nboolean exists = tables.stream().anyMatch(t -> t.getTableName().equalsIgnoreCase(tableName));\nif (!exists) throw new IllegalStateException(\"table not found: \" + tablePath);","typeGuard":null,"tryCatchPattern":"try {\n    List<Column> cols = mySqlCatalog.getTableColumns(tablePath);\n} catch (CatalogException e) {\n    log.error(\"column metadata failed for {}: {}\", tablePath, e.getCause().getMessage(), e);\n}","preventionTips":["Always pass schema.table, not a bare table name.","Run migrations and metadata reads against the same environment.","Verify grants on information_schema.","Check identifier casing against lower_case_table_names."],"tags":["jdbc","mysql","catalog","metadata"],"backgroundTag":"database-query-failed","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"}