alibaba/nacos · error · IOException

Failed to list contents of

Error message

Failed to list contents of {}

What it means

Error "Failed to list contents of {}" thrown in alibaba/nacos.

Solutions

  1. Inspect the server logs for the underlying cause, fix it, and retry the operation.

When it happens

Trigger: Thrown at common/src/main/java/com/alibaba/nacos/common/utils/IoUtils.java:263 when the library encounters an invalid state.

Common situations: Listing a directory that cannot be read (permissions or I/O error).


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/61005945df28e086. Report an issue: GitHub.

Appendix: source

Thrown at common/src/main/java/com/alibaba/nacos/common/utils/IoUtils.java:263

     *
     * @param directory directory
     * @throws IOException io exception
     */
    public static void cleanDirectory(File directory) throws IOException {
        if (!directory.exists()) {
            String message = directory + " does not exist";
            throw new IllegalArgumentException(message);
        }
        
        if (!directory.isDirectory()) {
            String message = directory + " is not a directory";
            throw new IllegalArgumentException(message);
        }
        
        File[] files = directory.listFiles();
        // null if security restricted
        if (files == null) {
            throw new IOException("Failed to list contents of " + directory);
        }
        
        IOException exception = null;
        for (File file : files) {
            try {
                delete(file);
            } catch (IOException ioe) {
                exception = ioe;
            }
        }
        
        if (null != exception) {
            throw exception;
        }
    }
    
    /**
     * Judge whether is Gzip stream.

View on GitHub (pinned to 9b989acdf1)