t8y2/dbx · warning · IllegalArgumentException
Unsupported object type: {objectType}
Error message
Unsupported object type: {objectType} What it means
PostgresLikeAgent.getObjectSource() builds catalog queries only for VIEW, MATERIALIZED VIEW, FUNCTION and PROCEDURE. Any other objectType string falls into the final else branch and throws IllegalArgumentException. The agent intentionally fails fast rather than returning an empty source, because it has no catalog query for that object kind.
Source
Thrown at agents/common/src/main/java/com/dbx/agent/PostgresLikeAgent.java:368
String upperType = objectType.toUpperCase();
String sql;
if ("VIEW".equals(upperType) || "MATERIALIZED VIEW".equals(upperType)) {
sql = "SELECT " + profile.catalogPrefixedFunction("get_viewdef") + "(" +
profile.catalogBuiltinFunction("to_regclass") + "(?), true)";
} else if ("FUNCTION".equals(upperType)) {
sql = "SELECT " + profile.catalogPrefixedFunction("get_functiondef") + "(p.oid)\n" +
"FROM " + profile.catalogRelation("proc") + " p JOIN " +
profile.catalogRelation("namespace") + " n ON n.oid = p.pronamespace\n" +
"WHERE n.nspname = ? AND p.proname = ? AND p.prokind = 'f'\n" +
"ORDER BY p.oid LIMIT 1";
} else if ("PROCEDURE".equals(upperType)) {
sql = "SELECT " + profile.catalogPrefixedFunction("get_functiondef") + "(p.oid)\n" +
"FROM " + profile.catalogRelation("proc") + " p JOIN " +
profile.catalogRelation("namespace") + " n ON n.oid = p.pronamespace\n" +
"WHERE n.nspname = ? AND p.proname = ? AND p.prokind = 'p'\n" +
"ORDER BY p.oid LIMIT 1";
} else {
throw new IllegalArgumentException("Unsupported object type: " + objectType);
}
String source;
if ("VIEW".equals(upperType) || "MATERIALIZED VIEW".equals(upperType)) {
try (java.sql.PreparedStatement stmt = requireConnection().prepareStatement(sql)) {
stmt.setString(1, quoteQualifiedIdentifier(schema, name));
try (ResultSet rs = stmt.executeQuery()) {
source = rs.next() ? coalesce(rs.getString(1)) : "";
}
}
} else {
try (java.sql.PreparedStatement stmt = requireConnection().prepareStatement(sql)) {
stmt.setString(1, schema);
stmt.setString(2, name);
try (ResultSet rs = stmt.executeQuery()) {
source = rs.next() ? coalesce(rs.getString(1)) : "";
}
}View on GitHub (pinned to c0390bff16)
Solutions
- Only call getObjectSource for VIEW, MATERIALIZED VIEW, FUNCTION, or PROCEDURE; fetch DDL for other object types via a different API (e.g. getTableDdl or column/metadata APIs).
- Normalize the type string before calling: trim, uppercase, and use a space in 'MATERIALIZED VIEW' (not 'MATERIALIZED_VIEW').
- Wrap the call in try-catch for IllegalArgumentException and fall back to a 'source unavailable' representation for unsupported types.
- If a new type is genuinely needed, extend PostgresLikeAgent.getObjectSource with a catalog query for that type (or override it in the concrete agent subclass).
Example fix
// before
ObjectSource src = agent.getObjectSource(schema, "my_seq", "SEQUENCE"); // throws
// after
String upper = objectType == null ? "" : objectType.trim().toUpperCase();
if (Set.of("VIEW", "MATERIALIZED VIEW", "FUNCTION", "PROCEDURE").contains(upper)) {
ObjectSource src = agent.getObjectSource(schema, name, objectType);
} else {
ObjectSource src = ObjectSource.unavailable(schema, name, objectType, "source not supported for " + upper);
} Defensive patterns
Strategy: validation
Validate before calling
private static final Set<String> SUPPORTED = Set.of("VIEW", "MATERIALIZED VIEW", "FUNCTION", "PROCEDURE");
boolean supported = objectType != null && SUPPORTED.contains(objectType.trim().toUpperCase());
if (!supported) { /* use alternative DDL API or skip */ } Type guard
static boolean hasObjectSourceSupport(String objectType) {
if (objectType == null) return false;
String t = objectType.trim().toUpperCase(Locale.ROOT);
return t.equals("VIEW") || t.equals("MATERIALIZED VIEW") || t.equals("FUNCTION") || t.equals("PROCEDURE");
} Try / catch
try {
ObjectSource src = agent.getObjectSource(schema, name, objectType);
} catch (IllegalArgumentException e) {
ObjectSource src = ObjectSource.unavailable(schema, name, objectType, "source not supported: " + e.getMessage());
} Prevention
- Check the agent's supported type list before calling getObjectSource
- Normalize type strings (trim/uppercase, space not underscore for 'MATERIALIZED VIEW')
- Route TABLE/SEQUENCE/TRIGGER requests to dedicated DDL or metadata APIs
- Handle unknown types gracefully in schema-browser loops instead of assuming full coverage
When it happens
Trigger: Calling getObjectSource(schema, name, objectType) with any type other than VIEW, MATERIALIZED VIEW, FUNCTION, or PROCEDURE — e.g. TABLE, SEQUENCE, TRIGGER, INDEX, TYPE, or a lowercase/mispelled variant like 'table' handled correctly only if it maps to a supported type (case is uppercased, but e.g. 'MATERIALIZED_VIEW' with underscore is NOT accepted).
Common situations: UI metadata refreshers iterating over all object kinds in a schema and requesting source for each; generic tooling that assumes getObjectSource supports every object type; passing PostgreSQL-specific type names like 'FOREIGN TABLE' or underscore-normalized 'MATERIALIZED_VIEW' that this agent does not handle.
Related errors
- Unsupported object type: {objectType}
- Query session not found: {sessionId}
- Agent runtime thread limits must be positive
- agentSessionId is required
- Unsupported object type: {objectType}
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/2b102643db3929ce.
Report an issue: GitHub.