t8y2/dbx · error · IllegalArgumentException

View source not found: " + name

Error message

View source not found: " + name

What it means

Gbase8sAgent.viewSource fetches a view's definition text; when the backing query returns no row (the view does not exist or the owner/schema does not match), it throws RuntimeException('View source not found: ' + name). The message template shown in the region confirms the name is appended.

Source

Thrown at agents/drivers/gbase8s/src/main/java/com/dbx/agent/gbase8s/Gbase8sAgent.java:510

    private String tableType(String schema, String table) {
        try {
            String owner = trim(schema);
            List<Object> args = new ArrayList<>();
            args.add(table);
            StringBuilder sql = new StringBuilder("SELECT tabtype FROM systables WHERE tabid >= 100 AND tabname = ?");
            if (!owner.isEmpty()) {
                sql.append(" AND owner = ?");
                args.add(owner);
            }
            try (PreparedStatement stmt = requireConnection().prepareStatement(sql.toString())) {
                bind(stmt, args);
                try (ResultSet rs = stmt.executeQuery()) {
                    return rs.next() ? tableType(rs.getString("tabtype")) : "";
                }
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private String viewSource(String schema, String name) {
        try {
            String owner = trim(schema);
            List<Object> args = new ArrayList<>();
            args.add(name);
            StringBuilder sql = new StringBuilder("""
                SELECT v.viewtext
                FROM sysviews v
                JOIN systables t ON t.tabid = v.tabid
                WHERE t.tabname = ?
                """.stripIndent().trim());
            if (!owner.isEmpty()) {
                sql.append(" AND t.owner = ?");
                args.add(owner);
            }

View on GitHub (pinned to c0390bff16)

Solutions

  1. Verify the view exists with the exact schema/owner and name (query systables/sysviews)
  2. Correct the schema/owner casing before calling
  3. Handle the RuntimeException and surface a 'view not found' message to the user

Example fix

// before
String src = agent.getObjectSource(schema, name, "VIEW").source();
// after
try {
    String src = agent.getObjectSource(schema, name, "VIEW").source();
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("View source not found")) {
        throw new NoSuchObjectException("View " + name + " does not exist in schema " + schema);
    }
    throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// confirm the view exists before requesting source
// SELECT tabtype FROM systables WHERE tabname = ? AND owner = ?  -> expect 'V'

Type guard

static boolean viewExists(ResultSet rs) throws SQLException { return rs.next() && "V".equals(rs.getString("tabtype")); }

Try / catch

try { src = agent.getObjectSource(schema, name, "VIEW"); } catch (RuntimeException e) { if (String.valueOf(e.getMessage()).startsWith("View source not found")) { throw new NoSuchObjectException(name); } throw e; }

Prevention

When it happens

Trigger: viewSource is called for a schema/name whose view row is absent from the system catalog (sysviews/systables), e.g. the view was dropped or the schema/owner casing is wrong.

Common situations: Stale catalog cache listing deleted views; case-sensitive Informix-style owner names not matching the stored owner; connecting to a different database than the one holding the view.

Related errors


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