{"record":{"id":"8e0e09796280b550","repo":"t8y2/dbx","slug":"table-not-found-schema-table","errorCode":null,"errorMessage":"Table not found: {schema}.{table}","messagePattern":"Table not found: (.+?)\\.(.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"agents/drivers/dameng/src/main/java/com/dbx/agent/dameng/DamengAgent.java","lineNumber":1680,"sourceCode":"        try {\n            return unchecked(() -> {\n                String sql = \"SELECT /*+ PARALLEL(1) */ DBMS_METADATA.GET_DDL(?, ?, ?) FROM DUAL\";\n                String ddl = null;\n                try (PreparedStatement stmt = requireConnected().prepareStatement(sql)) {\n                    stmt.setString(1, \"TABLE\");\n                    stmt.setString(2, table);\n                    stmt.setString(3, schema);\n                    try (ResultSet rs = stmt.executeQuery()) {\n                        if (rs.next()) {\n                            ddl = coalesce(readTextColumn(rs, 1));\n                        }\n                    }\n                }\n                if (ddl != null) {\n                    ddl = appendTableAndColumnComments(ddl, schema, table);\n                    return appendIndependentIndexDdl(ddl, schema, table);\n                }\n                throw new IllegalArgumentException(\"Table not found: \" + schema + \".\" + table);\n            });\n        } catch (RuntimeException error) {\n            if (!isDamengMetadataUnavailableError(error)) {\n                throw error;\n            }\n            try {\n                return super.getTableDdl(schema, table);\n            } catch (RuntimeException fallbackError) {\n                fallbackError.addSuppressed(error);\n                throw fallbackError;\n            }\n        }\n    }\n\n    @Override\n    public List<ColumnInfo> getColumns(String schema, String table) {\n        if (legacyJdbcMetadata) {\n            return StandardJdbcMetadata.INSTANCE.getColumns(","sourceCodeStart":1662,"sourceCodeEnd":1698,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/dameng/src/main/java/com/dbx/agent/dameng/DamengAgent.java#L1662-L1698","documentation":"DamengAgent.getDDL could not find any DDL for the requested schema.table. The metadata queries (including table, columns, and dependent objects) returned no rows, so instead of returning null/empty DDL the agent throws IllegalArgumentException. This indicates the table does not exist under that schema, or the caller lacks privileges to see its metadata.","triggerScenarios":"Calling the agent's DDL/source lookup (e.g. getDdl or source) with a schema/table combination for which the Dameng system metadata queries return no rows; ddl == null after the lookup, with the error not classified as a Dameng metadata-unavailable error.","commonSituations":"Typo in table or schema name; wrong case (Dameng stores identifiers uppercase by default); connecting as a user without SELECT privileges on the table or its metadata; querying a table in a different database or after it was dropped.","solutions":["Verify the table exists: SELECT * FROM ALL_TABLES / SYSTABLES WHERE TABLE_NAME = '<TABLE>' in the target schema.","Check schema and table casing — pass the identifier exactly as stored (usually uppercase) in Dameng.","Grant the connecting user SELECT/VIEW privileges on the table and system catalog views.","Confirm you are connected to the correct Dameng instance/database."],"exampleFix":"// before\nString ddl = agent.getDdl(conn, \"myschema\", \"mytable\");\n// after\nString ddl = agent.getDdl(conn, \"MYSCHEMA\", \"MYTABLE\"); // identifiers upper-cased, existence verified first","handlingStrategy":"validation","validationCode":"// Java (caller side)\nif (schema == null || schema.isBlank() || table == null || table.isBlank())\n    throw new IllegalArgumentException(\"schema/table required\");\ntry (var rs = conn.createStatement().executeQuery(\n        \"SELECT COUNT(*) FROM SYSCATALOG.SYSTABLES T \" +\n        \"WHERE T.TABLE_NAME='\" + table.toUpperCase() + \"'\")) {\n    if (!rs.next() || rs.getInt(1) == 0)\n        throw new IllegalArgumentException(\"Table does not exist: \" + schema + \".\" + table);\n}\nString ddl = agent.getDdl(conn, schema.toUpperCase(), table.toUpperCase());","typeGuard":null,"tryCatchPattern":"try {\n    ddl = agent.getDdl(conn, schema, table);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Table not found\")) {\n        LOG.warn(\"Skipping missing table {}.{}: {}\", schema, table, e.getMessage());\n        ddl = null; // or use Optional.empty()\n    } else { throw e; }\n}","preventionTips":["Always pass schema/table identifiers upper-cased as stored in Dameng.","Verify table existence in the catalog before requesting DDL.","Grant the connection user privileges to read system catalog metadata.","Wrap DDL fetches per-object so one missing table doesn't abort a batch run."],"tags":["metadata","dameng","table-not-found"],"backgroundTag":"table-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"}