{"record":{"id":"f07bf27f4f011cbf","repo":"bytebase/bytebase","slug":"failed-to-get-trino-version","errorCode":null,"errorMessage":"failed to get Trino version","messagePattern":"failed to get Trino version","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/plugin/db/trino/sync.go","lineNumber":17,"sourceCode":"package trino\n\nimport (\n\t\"context\"\n\n\t\"github.com/pkg/errors\"\n\n\tstorepb \"github.com/bytebase/bytebase/backend/generated-go/store\"\n\t\"github.com/bytebase/bytebase/backend/plugin/db\"\n\t\"github.com/bytebase/bytebase/backend/plugin/db/util\"\n)\n\n// SyncInstance syncs the instance.\nfunc (d *Driver) SyncInstance(ctx context.Context) (*db.InstanceMetadata, error) {\n\tversion, err := d.getVersion(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get Trino version\")\n\t}\n\n\tcatalogList, err := d.getCatalog(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get catalog list\")\n\t}\n\n\tvar catalogMetadata []*storepb.DatabaseSchemaMetadata\n\tfor _, catalog := range catalogList {\n\t\tcatalogMetadata = append(catalogMetadata, &storepb.DatabaseSchemaMetadata{\n\t\t\tName: catalog,\n\t\t})\n\t}\n\n\treturn &db.InstanceMetadata{\n\t\tVersion:   version,\n\t\tDatabases: catalogMetadata,\n\t\tMetadata:  &storepb.Instance{},","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/bytebase/bytebase/blob/1870550677fe08f0d2a78c07acd27541464eb945/backend/plugin/db/trino/sync.go#L1-L35","documentation":"SyncInstance starts instance metadata discovery by querying the Trino server version via d.getVersion(ctx). This error wraps any failure of that version query, aborting the sync before catalogs are read. It means the Trino coordinator could not be interrogated for its version.","triggerScenarios":"Calling (*trino.Driver).SyncInstance when the underlying SELECT for the version (typically a query against system.runtime.nodes or a driver-capability query) fails — connection refused, bad credentials, or an unexpected result set.","commonSituations":"Trino coordinator down or unreachable, wrong host/port in the instance DSN, Kerberos/TLS misconfiguration, or a proxy stripping the response.","solutions":["Check the wrapped error: if connection refused, verify the Trino coordinator host and port in the instance DSN","Test connectivity with curl to the coordinator's /v1/info endpoint","Verify authentication credentials (user/password, TLS certs, Kerberos keytab) are valid","Confirm the Trino server is running and healthy before re-running sync"],"exampleFix":"// before\ninstance, err := driver.SyncInstance(ctx) // fails: coordinator on :8081 not :8080\n// after\n// fix dsn: http://trino-coordinator:8081\ninstance, err := driver.SyncInstance(ctx)","handlingStrategy":"retry","validationCode":"conn, err := d.db.Conn(ctx)\nif err != nil {\n\treturn fmt.Errorf(\"trino unreachable before version sync: %w\", err)\n}\nconn.Close()","typeGuard":null,"tryCatchPattern":"version, err := d.getVersion(ctx)\nif err != nil {\n\tif isTransient(err) {\n\t\treturn retryWithBackoff(3, func() (*db.InstanceMetadata, error) { return d.SyncInstance(ctx) })\n\t}\n\treturn nil, errors.Wrap(err, \"failed to get Trino version\")\n}","preventionTips":["Health-check the coordinator (GET /v1/info) before syncing","Validate DSN host/port/credentials at instance-registration time","Set explicit connect and query timeouts","Use a dedicated service account with stable credentials"],"tags":["trino","connection","metadata-sync"],"backgroundTag":"sql-query-failed","analyzedSha":"1870550677fe08f0d2a78c07acd27541464eb945","analyzedAt":"2026-09-06T21:16:13.665Z","contentChangedAt":"2026-09-06T21:16:13.665Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}