{"record":{"id":"a8001737b6f9012f","repo":"t8y2/dbx","slug":"unsupported-object-type-for-hive-inceptor-routine","errorCode":null,"errorMessage":"Unsupported object_type for Hive/Inceptor routine source: ","messagePattern":"Unsupported object_type for Hive/Inceptor routine source: ","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java","lineNumber":4008,"sourceCode":"            }\n            String sc = emptyToNull(schema);\n            if (sc != null) {\n                candidates.add(sc);\n            }\n            if (candidates.isEmpty()) {\n                throw new SQLException(\"Object source requires database context for Hive/Inceptor routines\");\n            }\n\n            for (String candidateDb : candidates) {\n                String sql;\n                if (\"PROCEDURE\".equals(normalizedType)) {\n                    sql = \"SELECT full_text FROM system.procedures_v \" +\n                        \"WHERE lower(database_name) = lower(?) AND procedure_name = ?\";\n                } else if (\"FUNCTION\".equals(normalizedType)) {\n                    sql = \"SELECT full_text FROM system.functions_v \" +\n                        \"WHERE lower(database_name) = lower(?) AND function_name = ?\";\n                } else {\n                    throw new SQLException(\"Unsupported object_type for Hive/Inceptor routine source: \" + objectType);\n                }\n\n                try (PreparedStatement ps = conn.prepareStatement(sql)) {\n                    ps.setString(1, candidateDb);\n                    ps.setString(2, routineName);\n                    try (ResultSet rs = ps.executeQuery()) {\n                        if (!rs.next()) {\n                            continue;\n                        }\n                        ObjectNode item = MAPPER.createObjectNode();\n                        item.put(\"name\", name);\n                        item.put(\"object_type\", objectType);\n                        putNullable(item, \"schema\", emptyToNull(schema) != null ? schema : candidateDb);\n                        putNullable(item, \"source\", rs.getString(1));\n                        return item;\n                    }\n                }\n            }","sourceCodeStart":3990,"sourceCodeEnd":4026,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java#L3990-L4026","documentation":"After the database candidates are resolved, the plugin only knows how to build source queries for normalized types PROCEDURE and FUNCTION; any other objectType value hits the else branch and throws. The message concatenates the raw objectType so the caller can see the unsupported value.","triggerScenarios":"Calling the Hive/Inceptor object-source path with objectType values like \"TABLE\", \"VIEW\", lowercase \"function\" that failed to normalize, or a free-form string.","commonSituations":"Client sends the generic object type from a browse listing instead of mapping it to ROUTINE; UI passes VIEW sources through the routine branch; type-normalization drift after an API upgrade.","solutions":["Pass objectType exactly as \"PROCEDURE\" or \"FUNCTION\" for Hive/Inceptor routines","Route tables/views through the TABLE path (genericTableObjectSource or SHOW CREATE TABLE path) instead","Trim/normalize the type string client-side before the call","Check plugin version for newly supported routine types"],"exampleFix":"// before\ngetRoutineSource(conn, db, \"my_proc\", \"VIEW\");\n// after\ngetRoutineSource(conn, db, \"my_proc\", \"PROCEDURE\"); // or use the table/view source RPC","handlingStrategy":"validation","validationCode":"static boolean isRoutineType(String t) {\n    String n = t == null ? \"\" : t.trim().toUpperCase(Locale.ROOT);\n    return n.equals(\"PROCEDURE\") || n.equals(\"FUNCTION\");\n}\nif (!isRoutineType(objectType)) { /* route to table/view source path instead */ }","typeGuard":"boolean isProcedureOrFunction(String objectType) {\n    return \"PROCEDURE\".equalsIgnoreCase(objectType) || \"FUNCTION\".equalsIgnoreCase(objectType);\n}","tryCatchPattern":"try {\n    return rpc.objectSource(db, schema, name, objectType);\n} catch (SQLException e) {\n    if (e.getMessage().startsWith(\"Unsupported object_type\")) {\n        throw new UnsupportedOperationException(\"Type not supported for routine source: \" + objectType, e);\n    }\n    throw e;\n}","preventionTips":["Map browse-listing object types to PROCEDURE/FUNCTION before the source call","Normalize (trim/uppercase) type strings client-side","Send tables and views through the appropriate table source path","Verify supported types against the plugin version in use"],"tags":["jdbc","hive","unsupported-type"],"backgroundTag":"unsupported-object-type","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"}