The dependencies task output and then searching for FAILED is comparable to your task, isn’t it?
compileClasspath - Compile classpath for source set 'main'.
+--- junit:junit:4.+ -> 4.13.2
| \--- org.hamcrest:hamcrest-core:1.3 -> com.nothing:dne:1 FAILED
\--- com.nothing:dne:1 FAILED
That the dependencyInsight task does not help without the first-level dependency is probably just an artifact of the dependency substitution or could be considered a bug. If you call dependencyInsight with org.hamcrest:hamcrest-core it shows the expected output.
But anyway, my main point was, that the tasks work fine and as expected if the repository delivers 404 responses and that with responses that disturb those tasks, your custom task might be affected as well. But this is just a guess and hard to verify without being able to reproduce OPs situation. ![]()