{"record":{"id":"817b69328f88073d","repo":"t8y2/dbx","slug":"hiveserver2-metadata-failed-v-describe-fallbac","errorCode":null,"errorMessage":"HiveServer2 metadata failed (%v); DESCRIBE fallback failed: %w","messagePattern":"HiveServer2 metadata failed \\((.+?)\\); DESCRIBE fallback failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/argo-go/metadata.go","lineNumber":629,"sourceCode":"\t\t\tdataType := metadataString(rows.value(row, \"TYPE_NAME\"))\n\t\t\tcolumnSize := metadataIntPointer(rows.value(row, \"COLUMN_SIZE\"))\n\t\t\tvalues = append(values, columnInfo{\n\t\t\t\tName:                   name,\n\t\t\t\tDataType:               dataType,\n\t\t\t\tIsNullable:             metadataNullable(rows.value(row, \"NULLABLE\", \"IS_NULLABLE\")),\n\t\t\t\tColumnDefault:          optionalString(metadataString(rows.value(row, \"COLUMN_DEF\"))),\n\t\t\t\tComment:                optionalString(metadataString(rows.value(row, \"REMARKS\", \"COMMENT\"))),\n\t\t\t\tNumericPrecision:       columnSize,\n\t\t\t\tNumericScale:           metadataIntPointer(rows.value(row, \"DECIMAL_DIGITS\")),\n\t\t\t\tCharacterMaximumLength: characterLengthForType(dataType, columnSize),\n\t\t\t})\n\t\t}\n\t\treturn values, nil\n\t}\n\tqualified := qualifiedHiveName(schema, table)\n\tresult, err := server.executeQuery(queryOptions{SQL: \"DESCRIBE \" + qualified, MaxRows: metadataQueryLimit})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"HiveServer2 metadata failed (%v); DESCRIBE fallback failed: %w\", metadataErr, err)\n\t}\n\tvalues := make([]columnInfo, 0, len(result.Rows))\n\tfor _, row := range result.Rows {\n\t\tname := rowString(row, 0)\n\t\tif name == \"\" || strings.HasPrefix(name, \"#\") {\n\t\t\tcontinue\n\t\t}\n\t\tdataType := rowString(row, 1)\n\t\tcomment := optionalString(rowString(row, 2))\n\t\tvalues = append(values, columnInfo{\n\t\t\tName:       name,\n\t\t\tDataType:   dataType,\n\t\t\tIsNullable: true,\n\t\t\tComment:    comment,\n\t\t})\n\t}\n\treturn values, nil\n}","sourceCodeStart":611,"sourceCodeEnd":647,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/argo-go/metadata.go#L611-L647","documentation":"Column listing (getColumns/describe) tries HiveServer2 metadata (GetHiveColumns) first; on failure it runs 'DESCRIBE <schema>.<table>' as a fallback. This error is returned only when the metadata call AND the DESCRIBE fallback both fail, wrapping the metadata error (%v) and the DESCRIBE error (%w).","triggerScenarios":"Requesting columns for a table when the JDBC metadata call fails and 'DESCRIBE schema.table' also fails — typically the table does not exist, is misspelled, or the user lacks describe privileges.","commonSituations":"Wrong schema/table name in the request (typos, wrong case); table dropped or renamed; user without DESC privileges; connection dropped between the two attempts.","solutions":["Verify the table exists: run SHOW TABLES IN <schema> and confirm the exact name/case.","Run 'DESCRIBE <schema>.<table>' manually as the same user to see the underlying failure.","Check the user has SELECT/DESCRIBE privileges on the table.","Reconnect if the session was dropped (both attempts failing together often indicates a dead session)."],"exampleFix":"// before\ngetColumns(schema: \"sales\", table: \"orderss\")\n// after\ngetColumns(schema: \"sales\", table: \"orders\")","handlingStrategy":"validation","validationCode":"// Verify the table exists before asking for its columns.\nfunc tableExists(server *server, schema, table string) bool {\n    tables, err := server.listTables(schema, metadataListConstraints{Filter: table})\n    if err != nil {\n        return false\n    }\n    for _, t := range tables {\n        if strings.EqualFold(t.Name, table) {\n            return true\n        }\n    }\n    return false\n}\nif !tableExists(server, \"sales\", \"orders\") {\n    return nil, fmt.Errorf(\"table %s.%s does not exist or is not accessible\", \"sales\", \"orders\")\n}","typeGuard":null,"tryCatchPattern":"cols, err := server.getColumns(schema, table)\nif err != nil {\n    var inner error\n    if errors.As(err, &inner) {\n        log.Printf(\"describe failed for %s.%s: %v\", schema, table, inner)\n    }\n    if !tableExists(server, schema, table) {\n        return nil, fmt.Errorf(\"unknown table %s.%s\", schema, table)\n    }\n    return fmt.Errorf(\"column metadata unavailable: %w\", err)\n}","preventionTips":["Validate schema and table names (spelling and case) before requesting columns.","Ensure the connecting role has DESCRIBE/SELECT privileges on target tables.","Refresh metadata caches after DDL so dropped/renamed tables are not requested.","Check connection health with test_connection if metadata and DESCRIBE both fail."],"tags":["hive","metadata","describe","fallback"],"backgroundTag":"metadata-query-failed","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}