{"record":{"id":"b0e95f1b73d3d992","repo":"alibaba/canal","slug":"dbmapping-table-b0e95f","errorCode":null,"errorMessage":"dbMapping.table","messagePattern":"dbMapping\\.table","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/config/MappingConfig.java","lineNumber":87,"sourceCode":"\n    public String getDestination() {\n        return destination;\n    }\n\n    public void setDestination(String destination) {\n        this.destination = destination;\n    }\n\n    public AdapterMapping getMapping() {\n        return dbMapping;\n    }\n\n    public void validate() {\n        if (dbMapping.database == null || dbMapping.database.isEmpty()) {\n            throw new NullPointerException(\"dbMapping.database\");\n        }\n        if (!dbMapping.getMirrorDb() && (dbMapping.table == null || dbMapping.table.isEmpty())) {\n            throw new NullPointerException(\"dbMapping.table\");\n        }\n        if (!dbMapping.getMirrorDb() && (dbMapping.targetTable == null || dbMapping.targetTable.isEmpty())) {\n            throw new NullPointerException(\"dbMapping.targetTable\");\n        }\n    }\n\n    public static class DbMapping implements AdapterMapping {\n\n        private boolean             mirrorDb        = false;                 // 是否镜像库\n        private String              database;                                // 数据库名或schema名\n        private String              table;                                   // 表名\n        private Map<String, String> targetPk        = new LinkedHashMap<>(); // 目标表主键字段\n        private boolean             mapAll          = false;                 // 映射所有字段\n        private String              targetDb;                                // 目标库名\n        private String              targetTable;                             // 目标表名\n        private Map<String, String> targetColumns;                           // 目标表字段映射\n\n        private boolean             caseInsensitive = false;                 // 目标表不区分大小写，默认是否","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/client-adapter/rdb/src/main/java/com/alibaba/otter/canal/client/adapter/rdb/config/MappingConfig.java#L69-L105","documentation":"Thrown by rdb MappingConfig.validate() when dbMapping.table is null or empty AND mirrorDb is false. table is the source table name; for non-mirror mappings it is mandatory, but mirrorDb mappings (whole-schema sync) intentionally omit it, hence the getMirrorDb() guard.","triggerScenarios":"A non-mirror rdb mapping yml's dbMapping block omits or blanks 'table:', or mirrorDb is false/unset on a config that was meant to be a mirror.","commonSituations":"A table-mapping template had 'table:' deleted. A mirror-schema config forgot 'mirrorDb: true' so the validator still demands a table.","solutions":["For a table mapping, add a non-empty 'table:' under dbMapping.","If this is a whole-schema mirror, set 'mirrorDb: true' under dbMapping so table/targetTable are not required."],"exampleFix":"# table mapping fix\n# before\ndbMapping:\n  database: mytest\n# after\ndbMapping:\n  database: mytest\n  table: user\n# mirror-db alternative\ndbMapping:\n  mirrorDb: true\n  database: mytest","handlingStrategy":"validation","validationCode":"DbMapping m = config.getDbMapping();\nboolean needsTable = m == null || !m.getMirrorDb();\nif (needsTable && (m.getTable() == null || m.getTable().isEmpty())) {\n    throw new IllegalArgumentException(\n        \"rdb yml missing dbMapping.table for \" + fileName\n        + \" (or set mirrorDb:true for whole-schema sync)\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["For table mappings always set table; for whole-schema mirrors set mirrorDb:true instead.","Validate the mirrorDb/table combination in CI."],"tags":["rdb","config-validation","canal","yaml","mirror-db"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}