t8y2/dbx · error

SHOW DATABASES failed (%v); HiveServer2 metadata fallback fa

Error message

SHOW DATABASES failed (%v); HiveServer2 metadata fallback failed: %w

What it means

listDatabases first tries 'SHOW DATABASES' via direct SQL; if that fails it falls back to the HiveServer2 JDBC metadata API (GetHiveSchemas). This error is produced only when BOTH paths fail, wrapping the original SHOW DATABASES error (%v) and the metadata fallback error (%w). It means the driver could not enumerate databases at all.

Source

Thrown at agents/drivers/argo-go/metadata.go:242

			"productVersion":         version,
			"unquotedIdentifierCase": "mixed",
			"quotedIdentifierCase":   "mixed",
			"driverName":             driverName,
			"driverVersion":          "gohive-v2.1.0",
		},
	}, nil
}

func (server *server) listDatabases() ([]databaseInfo, error) {
	result, err := server.executeQuery(queryOptions{SQL: "SHOW DATABASES", MaxRows: metadataQueryLimit})
	if err == nil {
		return databaseInfoFromQueryRows(result.Rows), nil
	}
	metadataResult, metadataErr := server.hiveMetadata(func(ctx context.Context, provider gohive.MetadataProvider) (gohive.MetadataResult, error) {
		return provider.GetHiveSchemas(ctx, "%")
	})
	if metadataErr != nil {
		return nil, fmt.Errorf("SHOW DATABASES failed (%v); HiveServer2 metadata fallback failed: %w", err, metadataErr)
	}
	rows := newHiveMetadataRows(metadataResult)
	values := make([]databaseInfo, 0, len(rows.rows))
	seen := map[string]bool{}
	for _, row := range rows.rows {
		name := metadataString(rows.value(row, "TABLE_SCHEM", "SCHEMA_NAME"))
		if name == "" || seen[name] {
			continue
		}
		seen[name] = true
		values = append(values, databaseInfo{Name: name})
	}
	sort.Slice(values, func(first, second int) bool { return values[first].Name < values[second].Name })
	return values, nil
}

func databaseInfoFromQueryRows(rows [][]any) []databaseInfo {
	values := make([]databaseInfo, 0, len(rows))

View on GitHub (pinned to c0390bff16)

Solutions

  1. Re-run SHOW DATABASES manually as the same user to see the root cause error in the (%v) portion.
  2. Check the user's privileges to list databases/schemas on the HiveServer2 instance.
  3. Reconnect — the fallback often fails because the underlying session died; test_connection to verify connectivity.
  4. If SHOW DATABASES is unsupported by the backend, verify this agent targets ArgoDB; use the hive-go driver for vanilla Hive/Kyuubi/Impala.
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight: confirm the connection can run trivial queries and the user can list databases.
if _, err := server.executeQuery(queryOptions{SQL: "SELECT 1", MaxRows: 1}); err != nil {
    return fmt.Errorf("connection not usable before listing databases: %w", err)
}

Try / catch

dbs, err := server.listDatabases()
if err != nil {
    var cause error
    if errors.As(err, &cause) {
        log.Printf("listDatabases failed; wrapped cause: %v", cause)
    }
    // treat as connectivity/permission problem: surface both causes to the operator
    return fmt.Errorf("cannot enumerate databases; check privileges and HiveServer2 health: %w", err)
}

Prevention

When it happens

Trigger: Calling the 'metadata'/list_databases dispatch method when the server rejects 'SHOW DATABASES' (syntax not supported, insufficient privileges) AND the HiveServer2 GetHiveSchemas metadata call also fails (connection dropped, unsupported catalog, permission denied).

Common situations: Connecting to non-Hive backends (Kyuubi/Impala variants or restricted ArgoDB roles) where SHOW DATABASES is denied; stale connections after HiveServer2 restart; user lacking schema-list privileges; network interruption mid-metadata call.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/ee96d9ea9f1af7da. Report an issue: GitHub.