{"record":{"id":"8d3a5d774be22d30","repo":"gradle/gradle","slug":"cannot-expand-s-8d3a5d","errorCode":null,"errorMessage":"Cannot expand %s.","messagePattern":"Cannot expand (.+?)\\.","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"platforms/core-configuration/file-operations/src/main/java/org/gradle/api/internal/file/archive/ZipFileTree.java","lineNumber":113,"sourceCode":"        decompressionCoordinator.exclusiveAccessTo(expandedDir, () -> {\n            AtomicBoolean stopFlag = new AtomicBoolean();\n            try (ZipFile zip = ZipFile.builder().setFile(zipFile).get()) {\n                // The iteration order of zip.getEntries() is based on the hash of the zip entry. This isn't much use\n                // to us. So, collect the entries in a map and iterate over them in alphabetical order.\n                Iterator<ZipArchiveEntry> sortedEntries = entriesSortedByName(zip);\n                while (!stopFlag.get() && sortedEntries.hasNext()) {\n                    ZipArchiveEntry entry = sortedEntries.next();\n                    DetailsImpl details = new DetailsImpl(zipFile, expandedDir, entry, zip, stopFlag, chmod);\n                    if (entry.isDirectory()) {\n                        visitor.visitDir(details);\n                    } else {\n                        visitor.visitFile(details);\n                    }\n                }\n            } catch (GradleException e) {\n                throw e; // Gradle exceptions are already meant to be human-readable, so just rethrow it\n            } catch (Exception e) {\n                throw new GradleException(format(\"Cannot expand %s.\", getDisplayName()), e);\n            }\n        });\n    }\n\n    private Iterator<ZipArchiveEntry> entriesSortedByName(ZipFile zip) {\n        Map<String, ZipArchiveEntry> entriesByName = new TreeMap<>();\n        Enumeration<ZipArchiveEntry> entries = zip.getEntries();\n        while (entries.hasMoreElements()) {\n            ZipArchiveEntry entry = entries.nextElement();\n            entriesByName.put(entry.getName(), entry);\n        }\n        return entriesByName.values().iterator();\n    }\n\n    @Override\n    public Provider<File> getBackingFileProvider() {\n        return fileProvider;\n    }","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/gradle/gradle/blob/534f27719b66953f95cc907aae7f2c1b12f5482d/platforms/core-configuration/file-operations/src/main/java/org/gradle/api/internal/file/archive/ZipFileTree.java#L95-L131","documentation":"Gradle throws this error when the following condition is violated: Cannot expand <value>.","triggerScenarios":"Thrown at platforms/core-configuration/file-operations/src/main/java/org/gradle/api/internal/file/archive/ZipFileTree.java:113 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the archive file exists and is a valid, non-corrupted archive.","Specify the compression explicitly if the archive extension is misleading."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"534f27719b66953f95cc907aae7f2c1b12f5482d","analyzedAt":"2026-08-22T08:09:12.375Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}