mirror of
https://github.com/sbt/sbt.git
synced 2026-08-31 18:24:30 +02:00
When a file referenced by a task's inputs/outputs (e.g. `Compile / resources +=
file("nope.txt")`) does not exist, hashing the task's cache key threw a
NoSuchFileException deep inside sjsonnew serialization. It surfaced as an opaque
sjsonnew.SerializationException that dumped the entire input list, with the real
cause buried several `Caused by:` levels down, so users routinely mistook it for
a corrupt cache and reached for `clean`.
ActionCache.mkInput now catches the hashing failure, detects a NoSuchFileException
anywhere in the cause chain (ActionCache.findMissingFile), and throws a
MessageOnlyException naming the file:
[error] file referenced by the build does not exist: nope.txt
util-cache gains a dependency on util-control (a leaf module, no cycle) for
MessageOnlyException.
Fixes #9217.
Co-authored-by: Brian Hotopp <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
656 B
656 B
Clearer error when a referenced file does not exist
If a file added to a task's inputs/outputs (e.g. Compile / resources += file("nope.txt"))
does not exist, tasks such as package previously failed while hashing the task's cache
key with an opaque sjsonnew.SerializationException that dumped the entire input list, with
the real cause (NoSuchFileException) buried several Caused by: levels down. This was
routinely mistaken for a corrupt cache.
sbt now reports the missing file directly:
[error] file referenced by the build does not exist: nope.txt
This addresses #9217.