{"record":{"id":"6ae41246d7e76b6a","repo":"prestodb/presto","slug":"generic-internal-error-6ae412","errorCode":"GENERIC_INTERNAL_ERROR","errorMessage":"Distribution for dynamic system table must be ${SINGLE_COORDINATOR}","messagePattern":"Distribution for dynamic system table must be (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"critical","filePath":"presto-main-base/src/main/java/com/facebook/presto/connector/system/MetadataBasedSystemTablesProvider.java","lineNumber":60,"sourceCode":"        this.catalogName = requireNonNull(catalogName, \"catalogName is null\");\n    }\n\n    @Override\n    public Set<SystemTable> listSystemTables(ConnectorSession session)\n    {\n        return ImmutableSet.of();\n    }\n\n    @Override\n    public Optional<SystemTable> getSystemTable(ConnectorSession session, SchemaTableName tableName)\n    {\n        Optional<SystemTable> systemTable = metadata.getSystemTable(\n                ((FullConnectorSession) session).getSession(),\n                new QualifiedObjectName(catalogName, tableName.getSchemaName(), tableName.getTableName()));\n\n        // dynamic system tables require access to the transaction and thus can only run on the current coordinator\n        if (systemTable.isPresent() && systemTable.get().getDistribution() != SINGLE_COORDINATOR) {\n            throw new PrestoException(GENERIC_INTERNAL_ERROR, \"Distribution for dynamic system table must be \" + SINGLE_COORDINATOR);\n        }\n\n        return systemTable;\n    }\n}\n","sourceCodeStart":42,"sourceCodeEnd":66,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/connector/system/MetadataBasedSystemTablesProvider.java#L42-L66","documentation":"MetadataBasedSystemTablesProvider.getSystemTable enforces that any dynamic system table it returns uses SINGLE_COORDINATOR distribution, because dynamic tables need access to the coordinator's transaction context and can therefore only execute on the current coordinator. A table whose distribution differs indicates an internal/connector bug, so GENERIC_INTERNAL_ERROR (not a user error) is thrown.","triggerScenarios":"A connector registers a dynamic SystemTable whose getDistribution() returns something other than SystemTable.Distribution.SINGLE_COORDINATOR, and a query or procedure reads that system table via the metadata-based provider.","commonSituations":"Third-party or custom connectors implementing a dynamic system table with CONNECTOR_TO_DISTRIBUTED_NODES distribution; connector version mismatches where a table was updated without updating distribution; Presto engine changes tightening the invariant while a connector lags.","solutions":["Fix the connector: return SystemTable.Distribution.SINGLE_COORDINATOR from the dynamic system table's getDistribution().","Update the connector plugin to a version compatible with the running Presto server.","If you own neither, report the bug to the connector maintainer with the table name; this is not fixable from the query side."],"exampleFix":"// before\n@Override\npublic Distribution getDistribution() {\n    return Distribution.CONNECTOR_TO_DISTRIBUTED_NODES;\n}\n// after\n@Override\npublic Distribution getDistribution() {\n    return Distribution.SINGLE_COORDINATOR;\n}","handlingStrategy":"validation","validationCode":"if (systemTable.getDistribution() != SystemTable.Distribution.SINGLE_COORDINATOR) {\n    throw new IllegalStateException(\"Dynamic system table must use SINGLE_COORDINATOR distribution\");\n}","typeGuard":null,"tryCatchPattern":"try { tables = readSystemTable(...); }\ncatch (PrestoException e) { if (e.getErrorCode() == StandardErrorCode.GENERIC_INTERNAL_ERROR.toErrorCode()) { reportConnectorBug(tableName); } throw e; }","preventionTips":["Always return SINGLE_COORDINATOR from dynamic system tables in custom connectors","Pin connector plugin versions to the server version during upgrades","Add a connector test asserting every dynamic SystemTable's distribution"],"tags":["system-tables","connector-bug","internal-error"],"backgroundTag":"invalid-system-table-distribution","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}