{"record":{"id":"bc0d384dbee8203e","repo":"t8y2/dbx","slug":"hive-driver-does-not-expose-hiveserver2-metadata-r","errorCode":null,"errorMessage":"Hive driver does not expose HiveServer2 metadata RPCs","messagePattern":"Hive driver does not expose HiveServer2 metadata RPCs","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/argo-go/metadata.go","lineNumber":188,"sourceCode":"}\n\nfunc normalizeMetadataColumn(value string) string {\n\treturn strings.NewReplacer(\"_\", \"\", \"-\", \"\", \" \", \"\").Replace(strings.ToUpper(strings.TrimSpace(value)))\n}\n\nfunc (server *server) hiveMetadata(operation func(context.Context, gohive.MetadataProvider) (gohive.MetadataResult, error)) (gohive.MetadataResult, error) {\n\tconnection, err := server.requireConnection()\n\tif err != nil {\n\t\treturn gohive.MetadataResult{}, err\n\t}\n\tctx, cancel := context.WithCancel(context.Background())\n\tserver.setActiveOperation(cancel)\n\tdefer server.clearActiveOperation(cancel)\n\tvar result gohive.MetadataResult\n\terr = connection.Raw(func(rawConnection any) error {\n\t\tprovider, ok := rawConnection.(gohive.MetadataProvider)\n\t\tif !ok {\n\t\t\treturn errors.New(\"Hive driver does not expose HiveServer2 metadata RPCs\")\n\t\t}\n\t\tvar operationErr error\n\t\tresult, operationErr = operation(ctx, provider)\n\t\treturn operationErr\n\t})\n\treturn result, err\n}\n\nfunc (server *server) connectionInfo() (map[string]any, error) {\n\tversion := \"\"\n\tif result, err := server.executeQuery(queryOptions{SQL: \"SELECT VERSION()\", MaxRows: 1, TimeoutSecs: 5}); err == nil && len(result.Rows) > 0 && len(result.Rows[0]) > 0 {\n\t\tversion = stringValue(result.Rows[0][0])\n\t}\n\tusername := server.config.Username\n\tif result, err := server.executeQuery(queryOptions{SQL: \"SELECT CURRENT_USER()\", MaxRows: 1, TimeoutSecs: 5}); err == nil && len(result.Rows) > 0 && len(result.Rows[0]) > 0 {\n\t\tif current := stringValue(result.Rows[0][0]); current != \"\" {\n\t\t\tusername = current\n\t\t}","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/argo-go/metadata.go#L170-L206","documentation":"The driver wraps the underlying gohive connection via connection.Raw and expects it to implement gohive.MetadataProvider to run HiveServer2 metadata RPCs (GetHiveColumns, GetHiveTables, etc.). If the raw driver connection does not implement that interface, this error is returned — meaning the installed gohive version or underlying driver cannot expose HiveServer2 metadata RPCs.","triggerScenarios":"Calling any metadata function that funnels through hiveMetadata (getColumns, getTableComment, listTables metadata paths) when the raw connection obtained from connection.Raw fails the gohive.MetadataProvider type assertion.","commonSituations":"Using an older gohive version that predates the MetadataProvider interface; a wrapped/proxied driver (tracing middleware, database/sql decorator) that hides the real gohive connection type; wrong dialect connection stored on the server.","solutions":["Upgrade the gohive dependency to a version that implements gohive.MetadataProvider","Remove or bypass any wrapper around the driver connection so Raw returns the actual gohive connection","Verify the connection is genuinely a gohive Hive connection, not another driver type","Add a fallback metadata path (SHOW queries) when the interface is unavailable"],"exampleFix":"// before\n_ = \"github.com/beltran/gohive v0.x (no MetadataProvider)\"\n// after\nimport \"github.com/beltran/gohive\" // go.mod updated to a version with gohive.MetadataProvider\n// go get github.com/beltran/gohive@latest","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func supportsMetadata(raw any) bool {\n    _, ok := raw.(gohive.MetadataProvider)\n    return ok\n}\n// usage:\n// var raw any\n// _ = connection.Raw(func(r any) error { raw = r; return nil })\n// if !supportsMetadata(raw) { /* fall back to SHOW-based metadata */ }","tryCatchPattern":"result, err := server.getColumns(schema, table)\nif err != nil && strings.Contains(err.Error(), \"does not expose HiveServer2 metadata RPCs\") {\n    // fall back to DESCRIBE-formatted / SHOW COLUMNS queries\n}","preventionTips":["Pin gohive to a version implementing gohive.MetadataProvider","Do not wrap the gohive connection with decorators that break the type assertion","Test metadata RPC availability at startup","Implement SHOW-query fallbacks for older drivers"],"tags":["hiveserver2","metadata","interface","driver"],"backgroundTag":"interface-not-implemented","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}