spring-projects/spring-boot · error · IllegalStateException

File '${file}' is not readable

Error message

File '${file}' is not readable

What it means

Error "File '${file}' is not readable" thrown in spring-projects/spring-boot.

Source

Thrown at buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/ZipFileTarArchive.java:83

	public void writeTo(OutputStream outputStream) throws IOException {
		TarArchiveOutputStream tar = new TarArchiveOutputStream(outputStream);
		tar.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
		try (ZipFile zipFile = ZipFile.builder().setFile(this.zip).get()) {
			Enumeration<ZipArchiveEntry> entries = zipFile.getEntries();
			while (entries.hasMoreElements()) {
				ZipArchiveEntry zipEntry = entries.nextElement();
				copy(zipEntry, zipFile.getInputStream(zipEntry), tar);
			}
		}
		tar.finish();
	}

	private void assertArchiveHasEntries(File file) {
		try (ZipFile zipFile = ZipFile.builder().setFile(file).get()) {
			Assert.state(zipFile.getEntries().hasMoreElements(), () -> "Archive file '" + file + "' is not valid");
		}
		catch (IOException ex) {
			throw new IllegalStateException("File '" + file + "' is not readable", ex);
		}
	}

	private void copy(ZipArchiveEntry zipEntry, InputStream zip, TarArchiveOutputStream tar) throws IOException {
		TarArchiveEntry tarEntry = convert(zipEntry);
		tar.putArchiveEntry(tarEntry);
		if (tarEntry.isFile()) {
			StreamUtils.copyRange(zip, tar, 0, tarEntry.getSize());
		}
		tar.closeArchiveEntry();
	}

	private TarArchiveEntry convert(ZipArchiveEntry zipEntry) {
		byte linkFlag = (zipEntry.isDirectory()) ? TarConstants.LF_DIR : TarConstants.LF_NORMAL;
		String entryName = zipEntry.getName();
		Path entryPath = Path.of(entryName);
		Assert.state(entryPath.toAbsolutePath().equals(entryPath.toAbsolutePath().normalize()),
				() -> "Malformed zip entry name '%s'".formatted(entryName));

View on GitHub (pinned to 5b2dbdbb8b)

When it happens

Trigger: Thrown at buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/ZipFileTarArchive.java:83 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of spring-projects/spring-boot@5b2dbdbb8b (2026-08-04). Data as JSON: /data/errors/2007b838a0a096f1.json. Report an issue: GitHub.