Skip to content

Scaladoc 3.3.x falsely reports success despite errors #23561

@katrinafyi

Description

@katrinafyi

Compiler version

tested 3.3.4, 3.3.5, 3.3.6, and 3.3.7-RC1-bin-20250709-d743501-NIGHTLY

tested 3.7.1 did not have the bug.

Minimized code

in the affected versions, when a scaladoc error occurs, the error is not propagated to build tools. so, the build tools report a success but the docs output is incorrectly built, and this leads to downstream failures.

scaladoc-does-not-report-errors.tar.gz

to run the example:

tar xaf scaladoc-does-not-report-errors.tar.gz
cd scala-3-project-template
sbt doc && echo 'sbt success'
./mill foo.docJar && echo 'mill success'    

Output

the sbt and mill commands above will report "successful" completion, despite the printed error.

because this affects both build tools, and because the issue is not present in 3.7.1, i believe that the bug is in scaladoc not informing the build tool of its errors.

$ sbt doc && echo 'sbt success'
[info] Main Scala API documentation to /tmp/scala-3-project-template/target/scala-3.3.6/api...
-- Error: src/main/scala/Main.scala:23:12 --------------------------------------
23 |    println(m.parse(A))pile 0s
   |            ^^^^^^^^^
   |undefined: m.parse # -1: TermRef(TermRef(NoPrefix,val m),parse) at readTasty
1 error found
[info] Main Scala API documentation successful.
[success] Total time: 5 s, completed 18 July 2025, 8:12:34 pm
sbt success
$ ./mill foo.docJar && echo 'mill success'
[56/58] foo.compile
[56] [info] compiling 1 Scala source to /tmp/scala-3-project-template/out/foo/compile.dest/classes ...
[56] [info] done compiling
[58/58] foo.docJar
[58] -- Error: /tmp/scala-3-project-template/src/main/scala/Main.scala:23:12 --------
[58] 23 |    println(m.parse(A))
[58]    |            ^^^^^^^^^
[58]    |undefined: m.parse # -1: TermRef(TermRef(NoPrefix,val m),parse) at readTasty
[58] 1 error found
[58/58] ============================== foo.docJar ============================== 3s
mill success

observe that the produced folder is incomplete and broken (missing index.html, for example)

$ ls target/scala-3.3.6/api/      
favicon.ico  fonts  hljs  images  scaladoc.version  scripts  styles  webfonts

Expectation

scaladoc 3.3.x should propagate doc errors to the build tool.

if you change the scalaVersion to 3.7.1, both build tools will correctly report a failure.

the mill code that detects errors uses the Reporter#hasErrors method. I believe the bug could come from that being set incorrectly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions