{"record":{"id":"46c0f308fa2f15a4","repo":"apache/seatunnel","slug":"schema-config-need-option-schema-please-correct","errorCode":null,"errorMessage":"Schema config need option [schema], please correct your config first","messagePattern":"Schema config need option \\[schema\\], please correct your config first","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/CatalogTableUtil.java","lineNumber":197,"sourceCode":"                        CatalogTableUtil.getCatalogTable(\n                                id, ((MultipleRowType) seaTunnelDataType).getRowType(id)));\n            }\n        } else {\n            catalogTables =\n                    Collections.singletonList(\n                            CatalogTableUtil.getCatalogTable(\n                                    tableId, (SeaTunnelRowType) seaTunnelDataType));\n        }\n        return catalogTables;\n    }\n\n    public static CatalogTable buildWithConfig(ReadonlyConfig readonlyConfig) {\n        return buildWithConfig(\"\", readonlyConfig);\n    }\n\n    public static CatalogTable buildWithConfig(String catalogName, ReadonlyConfig readonlyConfig) {\n        if (readonlyConfig.get(ConnectorCommonOptions.SCHEMA) == null) {\n            throw new RuntimeException(\n                    \"Schema config need option [schema], please correct your config first\");\n        }\n        TableSchema tableSchema = new ReadonlyConfigParser().parse(readonlyConfig);\n\n        ReadonlyConfig schemaConfig =\n                readonlyConfig\n                        .getOptional(ConnectorCommonOptions.SCHEMA)\n                        .map(ReadonlyConfig::fromMap)\n                        .orElseThrow(\n                                () -> new IllegalArgumentException(\"Schema config can't be null\"));\n\n        TablePath tablePath;\n        if (StringUtils.isNotEmpty(schemaConfig.get(ConnectorCommonOptions.TABLE))) {\n            tablePath =\n                    TablePath.of(\n                            schemaConfig.get(ConnectorCommonOptions.TABLE),\n                            schemaConfig.get(ConnectorCommonOptions.SCHEMA_FIRST));\n        } else {","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/CatalogTableUtil.java#L179-L215","documentation":"CatalogTableUtil.buildWithConfig requires the 'schema' option to construct a CatalogTable manually. When the config lacks ConnectorCommonOptions.SCHEMA entirely, it throws RuntimeException telling the user to add the schema block.","triggerScenarios":"Calling buildWithConfig (directly or via getCatalogTables' schema path / connectors requiring manual schema) with a ReadonlyConfig that has no 'schema' key.","commonSituations":"Older configs that relied on automatic schema retrieval but are now run through a code path requiring an explicit schema; custom code invoking buildWithConfig on user config that never defined schema; connector docs/examples missing the schema section.","solutions":["Add a schema block with fields to the connector config","If schema should be auto-derived, use the path that queries the catalog instead of buildWithConfig","In custom code, check readonlyConfig.get(ConnectorCommonOptions.SCHEMA) != null before calling buildWithConfig"],"exampleFix":"// before\nsource {\n  FakeSource { }\n}\n// after\nsource {\n  FakeSource {\n    schema = {\n      fields {\n        id = int\n        name = string\n      }\n    }\n  }\n}","handlingStrategy":"validation","validationCode":"if (readonlyConfig.get(ConnectorCommonOptions.SCHEMA) == null) { throw new IllegalArgumentException(\"config must define schema\"); }","typeGuard":null,"tryCatchPattern":"try { CatalogTable t = CatalogTableUtil.buildWithConfig(cfg); } catch (RuntimeException e) { /* add schema block */ }","preventionTips":["Always include a schema block when using buildWithConfig paths","Document required schema in connector templates","Validate config before job submission"],"tags":["config","schema","missing-option"],"backgroundTag":"missing-required-config-field","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"}