dianping/cat · error · RuntimeException

Cant' create directory(%s)!

Error message

Cant' create directory(%s)!

What it means

Error "Cant' create directory(%s)!" thrown in dianping/cat.

Source

Thrown at cat-client/src/main/java/com/dianping/cat/support/Files.java:91

                  } else {
                     copyFile(file, new File(to, name));
                  }
               }
            }
         }
      }

      public void copyFile(File from, File to) throws IOException {
         createDir(to.getParentFile());

         IO.INSTANCE.copy(new FileInputStream(from), new FileOutputStream(to), AutoClose.INPUT_OUTPUT);
         to.setLastModified(from.lastModified());
      }

      public void createDir(File dir) {
         if (!dir.exists()) {
            if (!dir.mkdirs()) {
               throw new RuntimeException(String.format("Cant' create directory(%s)!", dir));
            }
         }
      }

      public boolean delete(File file) {
         return delete(file, false);
      }

      public boolean delete(File file, boolean recursive) {
         if (file.exists()) {
            if (file.isFile()) {
               return file.delete();
            } else if (file.isDirectory()) {
               if (recursive) {
                  File[] children = file.listFiles();

                  if (children != null) {
                     for (File child : children) {

View on GitHub (pinned to e815e74d4c)

Solutions

  1. Create parent directories before calling the file operation, or use a path that already exists.
  2. Check filesystem permissions on the target directory.
  3. Remove a conflicting file at the target path before creating the directory.

When it happens

Trigger: Triggered when Files directory creation fails because mkdirs() returns false, typically due to missing permissions, a file already existing at the path, or a full/read-only filesystem.

Common situations: See trigger scenarios.


AI-assisted analysis of dianping/cat@e815e74d4c (2026-08-14). Data as JSON: /api/errors/749daada9b3a714e. Report an issue: GitHub.