gradle/gradle · error · GradleException

Could not read path '%s'.

Error message

Could not read path '%s'.

What it means

Gradle throws this error when the following condition is violated: Could not read path '<value>'.

Source

Thrown at platforms/core-configuration/file-collections/src/main/java/org/gradle/api/internal/file/collections/PathVisitor.java:106

            visitor.visitFile(details);
        }
        return checkStopFlag();
    }

    private FileVisitDetails getFileVisitDetails(Path file, @Nullable BasicFileAttributes attrs) {
        FileVisitDetails dirDetails = directoryDetailsHolder.peek();
        if (dirDetails != null) {
            return AttributeBasedFileVisitDetailsFactory.getFileVisitDetails(file, dirDetails.getRelativePath(), attrs, stopFlag, fileSystem);
        } else {
            return AttributeBasedFileVisitDetailsFactory.getRootFileVisitDetails(file, rootPath, attrs, stopFlag, fileSystem);
        }
    }

    @Override
    public FileVisitResult visitFileFailed(Path file, IOException exc) {
        FileVisitDetails details = getFileVisitDetails(file, null);
        if (isNotFileSystemLoopException(exc) && shouldVisit(details)) {
            throw new GradleException(String.format("Could not read path '%s'.", file), exc);
        }
        return checkStopFlag();
    }

    private static boolean isNotFileSystemLoopException(@Nullable IOException e) {
        return e != null && !(e instanceof FileSystemLoopException);
    }

    @Override
    public FileVisitResult postVisitDirectory(Path dir, @Nullable IOException exc) {
        if (exc != null) {
            if (!(exc instanceof FileSystemLoopException)) {
                throw new GradleException(String.format("Could not read directory path '%s'.", dir), exc);
            }
        } else {
            if (postfix) {
                FileVisitDetails details = directoryDetailsHolder.peek();
                if (directoryDetailsHolder.size() > 1 && details != null) {

View on GitHub (pinned to 534f27719b)

Solutions

  1. Check file system permissions on the path and ensure the Gradle process can read it.

When it happens

Trigger: Thrown at platforms/core-configuration/file-collections/src/main/java/org/gradle/api/internal/file/collections/PathVisitor.java:106 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gradle/gradle@534f27719b (2026-08-22). Data as JSON: /api/errors/ac5443cc780cac62. Report an issue: GitHub.