t8y2/dbx · error · SQLException

Unsupported object_type for Hive/Inceptor routine source:

Error message

Unsupported object_type for Hive/Inceptor routine source: 

What it means

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.

Source

Thrown at plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java:4008

            }
            String sc = emptyToNull(schema);
            if (sc != null) {
                candidates.add(sc);
            }
            if (candidates.isEmpty()) {
                throw new SQLException("Object source requires database context for Hive/Inceptor routines");
            }

            for (String candidateDb : candidates) {
                String sql;
                if ("PROCEDURE".equals(normalizedType)) {
                    sql = "SELECT full_text FROM system.procedures_v " +
                        "WHERE lower(database_name) = lower(?) AND procedure_name = ?";
                } else if ("FUNCTION".equals(normalizedType)) {
                    sql = "SELECT full_text FROM system.functions_v " +
                        "WHERE lower(database_name) = lower(?) AND function_name = ?";
                } else {
                    throw new SQLException("Unsupported object_type for Hive/Inceptor routine source: " + objectType);
                }

                try (PreparedStatement ps = conn.prepareStatement(sql)) {
                    ps.setString(1, candidateDb);
                    ps.setString(2, routineName);
                    try (ResultSet rs = ps.executeQuery()) {
                        if (!rs.next()) {
                            continue;
                        }
                        ObjectNode item = MAPPER.createObjectNode();
                        item.put("name", name);
                        item.put("object_type", objectType);
                        putNullable(item, "schema", emptyToNull(schema) != null ? schema : candidateDb);
                        putNullable(item, "source", rs.getString(1));
                        return item;
                    }
                }
            }

View on GitHub (pinned to c0390bff16)

Solutions

  1. Pass objectType exactly as "PROCEDURE" or "FUNCTION" for Hive/Inceptor routines
  2. Route tables/views through the TABLE path (genericTableObjectSource or SHOW CREATE TABLE path) instead
  3. Trim/normalize the type string client-side before the call
  4. Check plugin version for newly supported routine types

Example fix

// before
getRoutineSource(conn, db, "my_proc", "VIEW");
// after
getRoutineSource(conn, db, "my_proc", "PROCEDURE"); // or use the table/view source RPC
Defensive patterns

Strategy: validation

Validate before calling

static boolean isRoutineType(String t) {
    String n = t == null ? "" : t.trim().toUpperCase(Locale.ROOT);
    return n.equals("PROCEDURE") || n.equals("FUNCTION");
}
if (!isRoutineType(objectType)) { /* route to table/view source path instead */ }

Type guard

boolean isProcedureOrFunction(String objectType) {
    return "PROCEDURE".equalsIgnoreCase(objectType) || "FUNCTION".equalsIgnoreCase(objectType);
}

Try / catch

try {
    return rpc.objectSource(db, schema, name, objectType);
} catch (SQLException e) {
    if (e.getMessage().startsWith("Unsupported object_type")) {
        throw new UnsupportedOperationException("Type not supported for routine source: " + objectType, e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling the Hive/Inceptor object-source path with objectType values like "TABLE", "VIEW", lowercase "function" that failed to normalize, or a free-form string.

Common situations: 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.

Related errors


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