{"record":{"id":"50e61cd272d55cc1","repo":"apache/seatunnel","slug":"table-schema-get-failed-50e61c","errorCode":"TABLE_SCHEMA_GET_FAILED","errorMessage":"Get table schema from file [%s] failed","messagePattern":"Get table schema from file \\[(.+?)\\] failed","errorType":"error_code","errorClass":"FileConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/source/config/HiveSourceConfig.java","lineNumber":333,"sourceCode":"            ReadonlyConfig readonlyConfig, Table table) {\n        // Keep a stable schema even when directory is empty.\n        return buildCatalogTableFromHiveMeta(readonlyConfig, table);\n    }\n\n    private CatalogTable parseCatalogTableFromRemotePath(\n            ReadonlyConfig readonlyConfig,\n            HadoopConf hadoopConf,\n            List<String> filePaths,\n            Table table) {\n        CatalogTable catalogTable = buildEmptyCatalogTable(readonlyConfig, table);\n        try {\n            SeaTunnelRowType seaTunnelRowTypeInfo =\n                    readStrategy.getSeaTunnelRowTypeInfo(filePaths.get(0));\n            return CatalogTableUtil.newCatalogTable(catalogTable, seaTunnelRowTypeInfo);\n        } catch (FileConnectorException e) {\n            String errorMsg =\n                    String.format(\"Get table schema from file [%s] failed\", filePaths.get(0));\n            throw new FileConnectorException(\n                    CommonErrorCodeDeprecated.TABLE_SCHEMA_GET_FAILED, errorMsg, e);\n        }\n    }\n\n    private CatalogTable parseCatalogTableFromTable(\n            ReadonlyConfig readonlyConfig, ReadStrategy readStrategy, Table table) {\n        SeaTunnelRowType seaTunnelRowType = buildRowTypeFromHiveMeta(table);\n        readStrategy.setCatalogTable(\n                CatalogTableUtil.getCatalogTable(\n                        \"hive\", table.getDbName(), null, table.getTableName(), seaTunnelRowType));\n        final SeaTunnelRowType finalSeatunnelRowType = readStrategy.getActualSeaTunnelRowTypeInfo();\n\n        CatalogTable catalogTable = buildEmptyCatalogTable(readonlyConfig, table);\n        return CatalogTableUtil.newCatalogTable(catalogTable, finalSeatunnelRowType);\n    }\n\n    /**\n     * Build a {@link CatalogTable} based on Hive metastore schema (table columns + optional","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/source/config/HiveSourceConfig.java#L315-L351","documentation":"When the Hive table is PARQUET or ORC, the schema is inferred by reading the first data file via readStrategy.getSeaTunnelRowTypeInfo(). If that read raises FileConnectorException, it is wrapped as TABLE_SCHEMA_GET_FAILED with the offending file path in the message.","triggerScenarios":"parseCatalogTableFromRemotePath() calls readStrategy.getSeaTunnelRowTypeInfo(filePaths.get(0)) and the underlying reader throws FileConnectorException — e.g. corrupt/inaccessible first file, checksum failure, unsupported schema in the file, or HDFS read IO error.","commonSituations":"First file under the table/partition is truncated or corrupted; permissions prevent reading the file as the job user; a parquet/orc file with an incompatible or empty schema; HDFS namenode unreachable during schema read.","solutions":["Open the reported file directly (e.g. `hdfs dfs -cat` / parquet-tools) to check it is readable and not corrupt","Verify the job user has read permission on the file path; adjust HDFS permissions or run as the correct user/kerberos principal","Delete or repair the corrupt file (or point table_paths at a healthy partition) so a good file becomes the schema source","If the file's schema is intentionally unusual, upgrade/align the connector's parquet-orc library versions, or rewrite the data"],"exampleFix":"// before: corrupt or unreadable first file used for schema inference\n// after: ensure healthy files\nhdfs fsck /user/hive/warehouse/db.db/tbl -files -blocks\n# remove/repair corrupt files, then rerun the SeaTunnel job","handlingStrategy":"try-catch","validationCode":"// Verify the schema source file is readable before running the job\norg.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration();\norg.apache.hadoop.fs.Path p = new org.apache.hadoop.fs.Path(firstFilePath);\ntry (org.apache.hadoop.fs.FSDataInputStream in = p.getFileSystem(conf).open(p)) {\n    in.read(); // probe read\n}","typeGuard":null,"tryCatchPattern":"try {\n    // ... build/submit Hive source\n} catch (org.apache.seatunnel.connectors.seatunnel.hive.exception.HiveConnectorException e) {\n    if (\"TABLE_SCHEMA_GET_FAILED\".equals(e.getSeaTunnelErrorCode().getCode())) {\n        LOG.error(\"Schema inference failed on file {} - verify it is readable/uncorrupt\", e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Periodically run hdfs fsck on warehouse directories to catch corrupt files","Grant the SeaTunnel job user read access to table/partition directories","Avoid leaving truncated files (kill -9 during writes); ensure writers close files","Point table_paths at partitions with known-good data files"],"tags":["hive","schema","parquet","orc","file-read"],"backgroundTag":"file-read-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}