{"record":{"id":"4bfc4301550de4d8","repo":"apache/dolphinscheduler","slug":"error-reading-file-filepath","errorCode":null,"errorMessage":"Error reading file: ${filePath}","messagePattern":"Error reading file: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-dms/src/main/java/org/apache/dolphinscheduler/plugin/task/dms/DmsHook.java","lineNumber":274,"sourceCode":"                return true;\n            } else if (stopStatusSet.contains(status)) {\n                break;\n            }\n        }\n        log.info(\"error\");\n        return false;\n    }\n\n    public String replaceFileParameters(String parameter) throws IOException {\n        if (parameter == null) {\n            return null;\n        }\n        if (parameter.startsWith(\"file://\")) {\n            String filePath = parameter.substring(7);\n            try {\n                return IOUtils.toString(new FileInputStream(filePath), StandardCharsets.UTF_8);\n            } catch (IOException e) {\n                throw new IOException(\"Error reading file: \" + filePath, e);\n            }\n        }\n        return parameter;\n    }\n\n    public ApplicationIds getApplicationIds() {\n        return new ApplicationIds(replicationTaskArn);\n    }\n\n    @Data\n    @AllArgsConstructor\n    @NoArgsConstructor\n    public static class ApplicationIds {\n\n        private String replicationTaskArn;\n    }\n\n    public static class STATUS {","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-dms/src/main/java/org/apache/dolphinscheduler/plugin/task/dms/DmsHook.java#L256-L292","documentation":"DmsHook.replaceFileParameters() resolves task parameters of the form 'file://<path>' by reading the file's UTF-8 contents inline. If the FileInputStream/IOUtils.read throws IOException (file missing, unreadable), it rethrows with 'Error reading file: <path>' plus the cause. This indicates a DMS replication-task config references a file the worker cannot read.","triggerScenarios":"A DMS task parameter starts with 'file://' but the path after it does not exist, is a directory, or is not readable by the worker process (IOException from FileInputStream or IOUtils.toString).","commonSituations":"Resource file not downloaded to the worker execution directory; typo in the file:// path; file created after task start; permissions changed on shared storage.","solutions":["Verify the file exists at the exact path on the worker: check the path printed in the error message.","Confirm the resource was attached to the task so it is downloaded to the execution directory before submit.","Check file permissions for the worker OS user (read access on file and parent dirs).","Correct the file:// parameter to point to an existing file, then rerun."],"exampleFix":"// before: missing file\n\"s3_properties\": \"file://./missing-s3.properties\"\n// after: ensure resource attached and path correct\n\"s3_properties\": \"file://./s3.properties\" // with s3.properties attached as task resource","handlingStrategy":"validation","validationCode":"String path = param.startsWith(\"file://\") ? param.substring(7) : null;\njava.io.File f = new java.io.File(path);\nboolean readable = f != null && f.isFile() && f.canRead();","typeGuard":"boolean isReadableFileParam(String param) {\n    if (!param.startsWith(\"file://\")) return true;\n    java.io.File f = new java.io.File(param.substring(7));\n    return f.isFile() && f.canRead();\n}","tryCatchPattern":"try {\n    dmsTask.submitApplication();\n} catch (Exception e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Error reading file:\")) {\n        log.error(\"Missing/unreadable file resource: {}\", e.getMessage());\n    }\n}","preventionTips":["Attach all file:// referenced files as task resources so workers download them.","Use relative paths within the execution directory consistently.","Check worker user read permissions on mounted resource directories."],"tags":["file-io","file-not-found","dms"],"backgroundTag":"file-not-found","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}