t8y2/dbx · error · IllegalArgumentException

Unsupported object type: {objectType}

Error message

Unsupported object type: {objectType}

What it means

Gbase8aAgent.getObjectSource only supports VIEW, PROCEDURE, and FUNCTION object types; anything else throws IllegalArgumentException. Unlike the Firebird agent it does not trim input, so ' procedure ' with spaces also fails despite case-insensitive matching.

Source

Thrown at agents/drivers/gbase8a/src/main/java/com/dbx/agent/gbase8a/Gbase8aAgent.java:190

    @Override
    public String getTableDdl(String schema, String table) {
        try {
            String ddl = showCreateDefinition("TABLE", schema, table);
            if (!ddl.isEmpty()) {
                return ddl;
            }
        } catch (RuntimeException ignored) {
            // Keep metadata-based DDL available for servers that restrict SHOW CREATE TABLE.
        }
        return super.getTableDdl(schema, table);
    }

    @Override
    public ObjectSource getObjectSource(String schema, String name, String objectType) {
        String normalizedType = objectType.toUpperCase(Locale.ROOT);
        if (!List.of("VIEW", "PROCEDURE", "FUNCTION").contains(normalizedType)) {
            throw new IllegalArgumentException("Unsupported object type: " + objectType);
        }
        return new ObjectSource(name, normalizedType, schema, showCreateDefinition(normalizedType, schema, name));
    }

    private String showCreateDefinition(String objectType, String schema, String name) {
        return unchecked(() -> {
            String qualifiedName = hasSchema(schema)
                ? JdbcIdentifiers.INSTANCE.backtick(schema) + "." + JdbcIdentifiers.INSTANCE.backtick(name)
                : JdbcIdentifiers.INSTANCE.backtick(name);
            try (Statement stmt = requireConnection().createStatement();
                 ResultSet rs = stmt.executeQuery("SHOW CREATE " + objectType + " " + qualifiedName)) {
                if (!rs.next()) {
                    return "";
                }
                // SHOW CREATE result layouts vary by GBase driver version, so locate the definition column by label.
                ResultSetMetaData metadata = rs.getMetaData();
                for (int index = 1; index <= metadata.getColumnCount(); index++) {
                    String label = metadata.getColumnLabel(index);

View on GitHub (pinned to c0390bff16)

Solutions

  1. Trim the object type string before passing it in
  2. Only request VIEW, PROCEDURE, or FUNCTION from this API; use getTableDdl for tables
  3. Validate/normalize object types at the caller boundary

Example fix

// before
agent.getObjectSource(schema, name, " VIEW ");
// after
agent.getObjectSource(schema, name, objectType.trim().toUpperCase(Locale.ROOT)); // ensure it is VIEW/PROCEDURE/FUNCTION
Defensive patterns

Strategy: validation

Validate before calling

String t = objectType == null ? "" : objectType.trim().toUpperCase(Locale.ROOT); if (!List.of("VIEW","PROCEDURE","FUNCTION").contains(t)) { throw new IllegalArgumentException("GBase8a source supports only VIEW/PROCEDURE/FUNCTION"); }

Type guard

static boolean isSupportedGbase8aObjectType(String t) { return t != null && List.of("VIEW","PROCEDURE","FUNCTION").contains(t.trim().toUpperCase(Locale.ROOT)); }

Try / catch

try { src = agent.getObjectSource(schema, name, type); } catch (IllegalArgumentException e) { log.warn("Unsupported GBase8a object type: {}", type); return null; }

Prevention

When it happens

Trigger: Calling getObjectSource(schema, name, objectType) with a type other than VIEW/PROCEDURE/FUNCTION (case-insensitive), e.g. 'TABLE', 'TRIGGER', or an untrimmed string like 'VIEW '.

Common situations: Passing type strings sourced from UI labels or other database metadata that include whitespace or different object kinds; requesting table DDL through the object-source API instead of getTableDdl.

Related errors


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