{"record":{"id":"61005945df28e086","repo":"alibaba/nacos","slug":"failed-to-list-contents-of","errorCode":null,"errorMessage":"Failed to list contents of {}","messagePattern":"Failed to list contents of (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/com/alibaba/nacos/common/utils/IoUtils.java","lineNumber":263,"sourceCode":"     *\n     * @param directory directory\n     * @throws IOException io exception\n     */\n    public static void cleanDirectory(File directory) throws IOException {\n        if (!directory.exists()) {\n            String message = directory + \" does not exist\";\n            throw new IllegalArgumentException(message);\n        }\n        \n        if (!directory.isDirectory()) {\n            String message = directory + \" is not a directory\";\n            throw new IllegalArgumentException(message);\n        }\n        \n        File[] files = directory.listFiles();\n        // null if security restricted\n        if (files == null) {\n            throw new IOException(\"Failed to list contents of \" + directory);\n        }\n        \n        IOException exception = null;\n        for (File file : files) {\n            try {\n                delete(file);\n            } catch (IOException ioe) {\n                exception = ioe;\n            }\n        }\n        \n        if (null != exception) {\n            throw exception;\n        }\n    }\n    \n    /**\n     * Judge whether is Gzip stream.","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/common/src/main/java/com/alibaba/nacos/common/utils/IoUtils.java#L245-L281","documentation":"Error \"Failed to list contents of {}\" thrown in alibaba/nacos.","triggerScenarios":"Thrown at common/src/main/java/com/alibaba/nacos/common/utils/IoUtils.java:263 when the library encounters an invalid state.","commonSituations":"Listing a directory that cannot be read (permissions or I/O error).","solutions":["Inspect the server logs for the underlying cause, fix it, and retry the operation."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}