{"record":{"id":"dec47415a7f998ab","repo":"t8y2/dbx","slug":"view-source-not-found-name","errorCode":null,"errorMessage":"View source not found: \" + name","messagePattern":"View source not found: \" \\+ name","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agents/drivers/gbase8s/src/main/java/com/dbx/agent/gbase8s/Gbase8sAgent.java","lineNumber":510,"sourceCode":"\n    private String tableType(String schema, String table) {\n        try {\n            String owner = trim(schema);\n            List<Object> args = new ArrayList<>();\n            args.add(table);\n            StringBuilder sql = new StringBuilder(\"SELECT tabtype FROM systables WHERE tabid >= 100 AND tabname = ?\");\n            if (!owner.isEmpty()) {\n                sql.append(\" AND owner = ?\");\n                args.add(owner);\n            }\n            try (PreparedStatement stmt = requireConnection().prepareStatement(sql.toString())) {\n                bind(stmt, args);\n                try (ResultSet rs = stmt.executeQuery()) {\n                    return rs.next() ? tableType(rs.getString(\"tabtype\")) : \"\";\n                }\n            }\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private String viewSource(String schema, String name) {\n        try {\n            String owner = trim(schema);\n            List<Object> args = new ArrayList<>();\n            args.add(name);\n            StringBuilder sql = new StringBuilder(\"\"\"\n                SELECT v.viewtext\n                FROM sysviews v\n                JOIN systables t ON t.tabid = v.tabid\n                WHERE t.tabname = ?\n                \"\"\".stripIndent().trim());\n            if (!owner.isEmpty()) {\n                sql.append(\" AND t.owner = ?\");\n                args.add(owner);\n            }","sourceCodeStart":492,"sourceCodeEnd":528,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/gbase8s/src/main/java/com/dbx/agent/gbase8s/Gbase8sAgent.java#L492-L528","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the view exists with the exact schema/owner and name (query systables/sysviews)","Correct the schema/owner casing before calling","Handle the RuntimeException and surface a 'view not found' message to the user"],"exampleFix":"// before\nString src = agent.getObjectSource(schema, name, \"VIEW\").source();\n// after\ntry {\n    String src = agent.getObjectSource(schema, name, \"VIEW\").source();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"View source not found\")) {\n        throw new NoSuchObjectException(\"View \" + name + \" does not exist in schema \" + schema);\n    }\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":"// confirm the view exists before requesting source\n// SELECT tabtype FROM systables WHERE tabname = ? AND owner = ?  -> expect 'V'","typeGuard":"static boolean viewExists(ResultSet rs) throws SQLException { return rs.next() && \"V\".equals(rs.getString(\"tabtype\")); }","tryCatchPattern":"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; }","preventionTips":["Verify schema/owner casing matches what is stored in the catalog","Refresh cached object listings after DDL changes (drops/renames)","Confirm you are connected to the database that actually contains the view"],"tags":["gbase8s","not-found","runtime","view-metadata"],"backgroundTag":"object-not-found","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}