t8y2/dbx · error · IllegalArgumentException
Unsupported object type: " + objectType
Error message
Unsupported object type: " + objectType
What it means
When fetching object source text from the OceanBase Oracle-mode data dictionary (ALL_SOURCE), queryDictionarySource maps the caller's object type to the dictionary TYPE value. Only PROCEDURE, FUNCTION, PACKAGE, TRIGGER, TYPE, PACKAGE_BODY and TYPE_BODY have dictionary source; anything else throws IllegalArgumentException because ALL_SOURCE would return nothing and the request is a programming error.
Source
Thrown at agents/drivers/oceanbase-oracle/src/main/java/com/dbx/agent/oceanbaseoracle/OceanBaseOracleAgent.java:408
}
private String queryDictionarySource(String owner, String name, String objectType) throws SQLException {
if ("VIEW".equals(objectType)) {
String sql = "SELECT TEXT FROM ALL_VIEWS WHERE OWNER = ? AND VIEW_NAME = ?";
try (var stmt = requireConnection().prepareStatement(sql)) {
stmt.setString(1, owner);
stmt.setString(2, name);
try (ResultSet rs = stmt.executeQuery()) {
return rs.next() ? rs.getString(1) : null;
}
}
}
String sourceType = switch (objectType) {
case "PROCEDURE", "FUNCTION", "PACKAGE", "TRIGGER", "TYPE" -> objectType;
case "PACKAGE_BODY" -> "PACKAGE BODY";
case "TYPE_BODY" -> "TYPE BODY";
default -> throw new IllegalArgumentException("Unsupported object type: " + objectType);
};
String sql = "SELECT TEXT FROM ALL_SOURCE WHERE OWNER = ? AND NAME = ? AND TYPE = ? ORDER BY LINE";
StringBuilder source = new StringBuilder();
try (var stmt = requireConnection().prepareStatement(sql)) {
stmt.setString(1, owner);
stmt.setString(2, name);
stmt.setString(3, sourceType);
try (ResultSet rs = stmt.executeQuery()) {
while (rs.next()) {
String line = rs.getString(1);
if (line != null) {
source.append(line);
}
}
}
}
return editableOracleSource(source.toString());
}View on GitHub (pinned to c0390bff16)
Solutions
- Only call getObjectSource for types that support dictionary source (check supportsDictionarySource first and show 'no source' for others).
- Normalize the type (trim, uppercase, spaces to underscores) before calling, e.g. "package body" -> PACKAGE_BODY.
- If a legitimate type is missing from the switch, add it to queryDictionarySource and the corresponding dictionary mapping.
Example fix
// before
source = getObjectSource(schema, name, "VIEW"); // throws
// after
if (supportsDictionarySource(normalizedType)) {
source = getObjectSource(schema, name, normalizedType);
} else {
source = ""; // views etc. have no ALL_SOURCE text
} Defensive patterns
Strategy: validation
Validate before calling
Set<String> DICTIONARY_SOURCE_TYPES = Set.of("PROCEDURE","FUNCTION","PACKAGE","TRIGGER","TYPE","PACKAGE_BODY","TYPE_BODY");
if (!DICTIONARY_SOURCE_TYPES.contains(objectType)) {
// show "no source" instead of calling getObjectSource
} Type guard
boolean supportsDictionarySource(String t) {
return t != null && Set.of("PROCEDURE","FUNCTION","PACKAGE","TRIGGER","TYPE","PACKAGE_BODY","TYPE_BODY")
.contains(t.trim().toUpperCase(Locale.ROOT).replace(' ', '_'));
} Try / catch
try {
source = getObjectSource(schema, name, type);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unsupported object type")) {
source = ""; // no dictionary source for this kind
} else throw e;
} Prevention
- Normalize types (trim/uppercase/spaces-to-underscores) before any dictionary call.
- Check supportsDictionarySource before requesting source.
- Keep the accepted-type list in sync across queryDictionarySource, normalizeObjectSourceType and UI filters.
When it happens
Trigger: Calling getObjectSource (via getObjectSource) for an OceanBase object whose type is not one of the seven dictionary-backed kinds — e.g. requesting source for a VIEW, SEQUENCE, MATERIALIZED_VIEW, or a misspelled/unnormalized type string.
Common situations: UI passes through a type label from a metadata listing that includes views or sequences; a caller forgets to normalize "package body" (with a space) to PACKAGE_BODY first; new object types appear in a metadata catalog version before this switch was updated.
Related errors
- Query timeout cannot be negative: " + timeoutSecs
- Unsupported object type: " + objectType
- Unsupported object type: " + objectType
- Unsupported object type: " + objectType
- Unsupported object type: null
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/65be9ce46a0a30a4.
Report an issue: GitHub.