{"record":{"id":"4a368e5cecf942cb","repo":"apache/seatunnel","slug":"get-file-names-error-path-is-s","errorCode":null,"errorMessage":"get file names error,path is s%","messagePattern":"get file names error,path is s%","errorType":"exception","errorClass":"IMapStorageException","httpStatus":null,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/wal/reader/DefaultReader.java","lineNumber":85,"sourceCode":"    }\n\n    private List<String> getFileNames(Path parentPath) {\n        try {\n            if (!fs.exists(parentPath)) {\n                return new ArrayList<>();\n            }\n            RemoteIterator<LocatedFileStatus> fileStatusRemoteIterator =\n                    fs.listFiles(parentPath, true);\n            List<String> fileNames = new ArrayList<>();\n            while (fileStatusRemoteIterator.hasNext()) {\n                LocatedFileStatus fileStatus = fileStatusRemoteIterator.next();\n                if (fileStatus.getPath().getName().endsWith(\"wal.txt\")) {\n                    fileNames.add(fileStatus.getPath().toString());\n                }\n            }\n            return fileNames;\n        } catch (IOException e) {\n            throw new IMapStorageException(e, \"get file names error,path is s%\", parentPath);\n        }\n    }\n\n    private List<IMapFileData> readData(Path path) throws IOException {\n        List<IMapFileData> result = new ArrayList<>(DEFAULT_QUERY_LIST_SIZE);\n        long length = fs.getFileStatus(path).getLen();\n        try (FSDataInputStream in = fs.open(path)) {\n            byte[] datas = new byte[(int) length];\n            in.readFully(datas);\n            int startIndex = 0;\n            while (startIndex + WAL_DATA_METADATA_LENGTH < datas.length) {\n\n                byte[] metadata = new byte[WAL_DATA_METADATA_LENGTH];\n                System.arraycopy(datas, startIndex, metadata, 0, WAL_DATA_METADATA_LENGTH);\n                int dataLength = WALDataUtils.byteArrayToInt(metadata);\n                startIndex += WAL_DATA_METADATA_LENGTH;\n                if (startIndex + dataLength > datas.length) {\n                    break;","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-storage/imap-storage-plugins/imap-storage-file/src/main/java/org/apache/seatunnel/engine/imap/storage/file/wal/reader/DefaultReader.java#L67-L103","documentation":"IMapStorageException thrown by DefaultReader.getFileNames when listing WAL segment files under parentPath throws an IOException. Only files whose name ends with \"wal.txt\" are collected; any failure during the filesystem listStatus call is wrapped in this error. Note the message has a typo: 's%' instead of '%s', so the path will not be interpolated into the message text.","triggerScenarios":"Calling DefaultReader.getFileNames(parentPath) when the directory doesn't exist, is not readable, or the underlying filesystem (HDFS/S3/OSS) raises IOException during listing.","commonSituations":"WAL directory deleted or never created; wrong path in storage config; permission issues on the storage backend; network partition to HDFS/S3/OSS mid-read.","solutions":["Verify parentPath exists and is readable (fs.exists / fs.canRead equivalent)","Check the storage backend connectivity and permissions","Correct the path in the storage configuration","Inspect the wrapped IOException stack trace for the real cause","Optionally fix the format-string typo 's%' -> '%s' in the source"],"exampleFix":"// before\nthrow new IMapStorageException(e, \"get file names error,path is s%\", parentPath);\n// after\nthrow new IMapStorageException(e, \"get file names error, path is %s\", parentPath);","handlingStrategy":"try-catch","validationCode":"if (!fs.exists(new Path(parentPath))) throw new IllegalStateException(\"WAL dir missing: \" + parentPath);","typeGuard":null,"tryCatchPattern":"try {\n    fileNames = reader.getFileNames(parentPath);\n} catch (IMapStorageException e) {\n    LOG.warn(\"WAL listing failed for {}\", parentPath, e.getCause());\n    return Collections.emptyList(); // or retry\n}","preventionTips":["Check directory existence and permissions before listing","Monitor storage backend health (NameNode/S3/OSS availability)","Remember the message typo: path won't appear in the message; log it separately"],"tags":["java","filesystem","list-files","imap-storage"],"backgroundTag":"file-read-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}