{"record":{"id":"40a30ee6253cda46","repo":"apache/seatunnel","slug":"illegal-state","errorCode":"ILLEGAL_STATE","errorMessage":"Databend catalog is not opened. Please call open() first.","messagePattern":"Databend catalog is not opened\\. Please call open\\(\\) first\\.","errorType":"error_code","errorClass":"DatabendConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/catalog/DatabendCatalog.java","lineNumber":515,"sourceCode":"                return LocalTimeType.LOCAL_DATE_TYPE;\n            case \"TIMESTAMP\":\n                return LocalTimeType.LOCAL_DATE_TIME_TYPE;\n            case \"VARBINARY\":\n            case \"BINARY\":\n                return BasicType.BYTE_TYPE;\n            default:\n                log.warn(\"Unsupported Databend type: {}, fallback to STRING type\", typeName);\n                return BasicType.STRING_TYPE;\n        }\n    }\n\n    private Connection getConnection() throws SQLException {\n        return DatabendUtil.createConnection(this.readonlyConfig);\n    }\n\n    private void checkOpen() {\n        if (!isOpened) {\n            throw new DatabendConnectorException(\n                    DatabendConnectorErrorCode.ILLEGAL_STATE,\n                    \"Databend catalog is not opened. Please call open() first.\");\n        }\n    }\n}\n","sourceCodeStart":497,"sourceCodeEnd":521,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/catalog/DatabendCatalog.java#L497-L521","documentation":"Guard in DatabendCatalog that fires when a catalog operation is invoked before open() has been called. The catalog tracks an isOpened flag; all database/table operations require an established catalog lifecycle. This is an API misuse / lifecycle error, not a connectivity problem.","triggerScenarios":"Calling databaseExists, listDatabases, listTables, tableExists, getTable, or createTable on a DatabendCatalog instance that was constructed but never had open() invoked (or after a hypothetical close).","commonSituations":"Using the catalog directly in custom code without the framework's open lifecycle; instantiating the catalog in tests and calling methods immediately; calling catalog methods after open() failed silently earlier.","solutions":["Call catalog.open() (with proper Config) before invoking any catalog methods","Verify the framework/plugin lifecycle that should call open() on your behalf is running","Check that open() did not throw or get skipped due to earlier errors"],"exampleFix":"// before\nDatabendCatalog catalog = new DatabendCatalog(readonlyConfig);\nboolean exists = catalog.tableExists(tablePath);\n// after\nDatabendCatalog catalog = new DatabendCatalog(readonlyConfig);\ncatalog.open();\nboolean exists = catalog.tableExists(tablePath);","handlingStrategy":"type-guard","validationCode":"if (!catalog.isOpen()) { catalog.open(); }","typeGuard":"boolean usable(DatabendCatalog c) { return c.isOpen(); }","tryCatchPattern":"try {\n    catalog.listTables(database);\n} catch (DatabendConnectorException e) {\n    if (e.getErrorCode() == DatabendConnectorErrorCode.ILLEGAL_STATE) {\n        catalog.open();\n    } else { throw e; }\n}","preventionTips":["Always call open() immediately after constructing the catalog","Use try-with-resources or lifecycle hooks to manage open/close","In tests, build the catalog via a helper that opens it first"],"tags":["databend","catalog","lifecycle","illegal-state"],"backgroundTag":"invalid-state-transition","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}