{"record":{"id":"267684802ee7578c","repo":"alibaba/canal","slug":"read-mapping-config-error","errorCode":null,"errorMessage":"Read {}mapping config: {} error. ","messagePattern":"Read (.+?)mapping config: (.+?) error\\. ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/MappingConfigsLoader.java","lineNumber":39,"sourceCode":"            if (url != null) {\n                configDir = new File(url.getPath() + name + File.separator);\n            }\n        }\n\n        File[] files = configDir.listFiles();\n        if (files != null) {\n            for (File file : files) {\n                String fileName = file.getName();\n                if (!fileName.endsWith(\".yml\")) {\n                    continue;\n                }\n                try (InputStream in = new FileInputStream(file)) {\n                    byte[] bytes = new byte[in.available()];\n                    in.read(bytes);\n                    String configContent = new String(bytes, StandardCharsets.UTF_8);\n                    configContentMap.put(fileName, configContent);\n                } catch (IOException e) {\n                    throw new RuntimeException(\"Read \" + name + \"mapping config: \" + fileName + \" error. \", e);\n                }\n            }\n        }\n\n        return configContentMap;\n    }\n\n    public static String loadConfig(String name) {\n        // 先取本地文件，再取类路径\n        File filePath = new File(\"..\" + File.separator + Constant.CONF_DIR + File.separator + name);\n        if (!filePath.exists()) {\n            URL url = MappingConfigsLoader.class.getClassLoader().getResource(\"\");\n            if (url != null) {\n                filePath = new File(url.getPath() + name);\n            }\n        }\n        if (filePath.exists()) {\n            String fileName = filePath.getName();","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/MappingConfigsLoader.java#L21-L57","documentation":"Error \"Read {}mapping config: {} error. \" thrown in alibaba/canal.","triggerScenarios":"Thrown at client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/support/MappingConfigsLoader.java:39 when the library encounters an invalid state.","commonSituations":"Failed reading an adapter mapping config. Include the file path and parse cause, validate required keys right after load, and fail startup on malformed YAML.","solutions":["Validate the mapping YAML file syntax (indentation, quoting) for the reported config path.","Ensure the mapping file exists in conf/ (or the configured config dir) and is readable.","Check the file encoding is UTF-8 without BOM."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}