Skip to content

Fix NoSuchFileException in AbsolutePath.deleteRecursively - #89

Merged
rochala merged 1 commit into
mainfrom
fix/delete-recursively-missing-path
Jun 15, 2026
Merged

rochala merged 1 commit into
mainfrom
fix/delete-recursively-missing-path

Conversation

@rochala

@rochala rochala commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Problem

AbsolutePath.deleteRecursively called Files.walk(ap) unconditionally. When the target directory doesn't exist, Files.walk throws NoSuchFileException rather than no-opping. This surfaced on didSave (ServerImpl.handleDidSave), where targetInfo.classesDir.deleteRecursively runs before the classes dir has been populated:

java.nio.file.NoSuchFileException: .../.sls/classes/sls
  at ...Files.walk(...)
  at AbsolutePath$.deleteRecursively(paths.scala:35)
  at ServerImpl.$anonfun$4$$anonfun$1(ServerImpl.scala:267)

Fix

Guard the walk on existence. This matches the rm -rf semantics already implied by the internal deleteIfExists, and makes all three callers (ServerImpl x2, TastyIndexer) safe against missing paths.

🤖 Generated with Claude Code

deleteRecursively walked the path unconditionally, so Files.walk threw
NoSuchFileException when the target directory did not exist yet (e.g. the
first didSave before classesDir is populated). Guard the walk on
existence, matching the rm -rf semantics already implied by the internal
deleteIfExists.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rochala
rochala merged commit 4f3322e into main Jun 15, 2026
1 check passed
@rochala
rochala deleted the fix/delete-recursively-missing-path branch June 15, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant