{"record":{"id":"4705ea2d2ce4cc30","repo":"alibaba/canal","slug":"dbmapping-database-4705ea","errorCode":null,"errorMessage":"dbMapping.database","messagePattern":"dbMapping\\.database","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"client-adapter/tablestore/src/main/java/com/alibaba/otter/canal/client/adapter/tablestore/config/MappingConfig.java","lineNumber":98,"sourceCode":"    public Boolean getUpdateChangeColumns() {\n        return updateChangeColumns;\n    }\n\n    public void setUpdateChangeColumns(Boolean updateChangeColumns) {\n        this.updateChangeColumns = updateChangeColumns;\n    }\n\n    public Integer getThreads() {\n        return threads;\n    }\n\n    public void setThreads(Integer threads) {\n        this.threads = threads;\n    }\n\n    public void validate() {\n        if (dbMapping.database == null || dbMapping.database.isEmpty()) {\n            throw new NullPointerException(\"dbMapping.database\");\n        }\n        if (dbMapping.table == null || dbMapping.table.isEmpty()) {\n            throw new NullPointerException(\"dbMapping.table\");\n        }\n        if (dbMapping.targetTable == null || dbMapping.targetTable.isEmpty()) {\n            throw new NullPointerException(\"dbMapping.targetTable\");\n        }\n    }\n\n\n\n\n    public static class ColumnItem {\n        private String targetColumn;\n        private String  column;\n        private TablestoreFieldType type;\n\n        public String getColumn() {","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/client-adapter/tablestore/src/main/java/com/alibaba/otter/canal/client/adapter/tablestore/config/MappingConfig.java#L80-L116","documentation":"Thrown by MappingConfig.validate() when dbMapping.database is null or empty. This is one of three required fields validated in sequence (database, then table, then targetTable). validate() is called during ConfigLoader.load(), so this surfaces wrapped in the 'ERROR Config: {fileName}' RuntimeException. The exception type is NullPointerException despite being a validation check, not an unexpected null dereference.","triggerScenarios":"Loading a tablestore mapping config YAML where the dbMapping.database field is absent, null, or an empty string. The validate() method checks this first and throws immediately.","commonSituations":"YAML file missing the `database:` line under dbMapping; indentation error places database at the wrong nesting level; template/config-generation tool omitted the field; environment-specific override file blanked out the value.","solutions":["Add a non-empty `database` value under the `dbMapping` key in the YAML config.","Verify YAML indentation — dbMapping children must be indented under dbMapping.","If using environment variable substitution, ensure the variable resolves to a non-empty value."],"exampleFix":"// before\ndbMapping:\n  table: users\n  targetTable: ots_users\n\n// after\ndbMapping:\n  database: mydb\n  table: users\n  targetTable: ots_users","handlingStrategy":"validation","validationCode":"// Check dbMapping.database before calling validate()\nif (config.getDbMapping() == null\n    || config.getDbMapping().getDatabase() == null\n    || config.getDbMapping().getDatabase().isEmpty()) {\n    throw new IllegalArgumentException(\"dbMapping.database is required and must not be empty\");\n}","typeGuard":"null","tryCatchPattern":"try {\n    config.validate();\n} catch (NullPointerException e) {\n    if (\"dbMapping.database\".equals(e.getMessage())) {\n        logger.error(\"Missing required field: dbMapping.database\");\n    }\n    throw e;\n}","preventionTips":["Always include a non-empty `database` under dbMapping in every tablestore mapping YAML.","Use YAML schema validation in CI to catch missing required fields.","Document required fields prominently in config templates."],"tags":["tablestore-adapter","config-validation","required-field","config-error"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}