Describe the bug
We moved to using Sonatype Central for publishing artifacts and several attempts to run sonatypeBundleRelease end with a BUNDLE_UPLOAD_FAILURE error after about 30 seconds (see the logs below). The fact that it fails consistently at around 30 seconds makes me think that there has to be a timeout setting I have to tweak but I have no idea of which one should it be. This never happened before switching to Sonatype Central.
The bundle was 347MB and after the failure I uploaded the bundle manually through the Sonatype Central UI and it accepted and validated the bundle, currently publishing.
How to reproduce the issue
Move to using Sonatype Central for publishing and try to sonatypeReleaseBundle a huge bundle. Not common, but it happens to us with Kamon's publishing across all Scala versions.
- sbt version: 1.9.6
- sbt-sonatype version: 3.12.2
- Show your build settings (the same settings are applied to all projects):
$ sbt
> sonatypeProfileName
[info] sonatypeProfileName
[info] io.kamon
> sonatypeRepository
[info] sonatypeRepository
[info] https://central.sonatype.com/service/local
Additional context
Here are the logs from my last attempt:
sbt:kamon> sonatypeBundleRelease
2025-04-10 09:31:06.049+0200 info [SonatypeCentralClient] Uploading bundle /home/ivantopo/code/kamon/target/sonatype-staging/2.7.6-bundle/bundle.zip to Sonatype Central - (SonatypeCentralClient.scala:72)
09:31:37.125 [main] ERROR sttp.client4.logging.slf4j.Slf4jLoggingBackend - Exception when sending request: POST https://central.sonatype.com/api/v1/publisher/upload?publishingType=AUTOMATIC&name=io.kamon.kamon-2.7.6, took: 31.007s
sttp.client4.SttpClientException$ReadException: Exception when sending request: POST https://central.sonatype.com/api/v1/publisher/upload?publishingType=AUTOMATIC&name=io.kamon.kamon-2.7.6
at sttp.client4.SttpClientExceptionExtensions.defaultExceptionToSttpClientException(SttpClientExceptionExtensions.scala:24) ~[?:?]
at sttp.client4.SttpClientExceptionExtensions.defaultExceptionToSttpClientException$(SttpClientExceptionExtensions.scala:10) ~[?:?]
at sttp.client4.SttpClientException$.defaultExceptionToSttpClientException(SttpClientException.scala:24) ~[?:?]
at sttp.client4.httpurlconnection.HttpURLConnectionBackend.$anonfun$adjustExceptions$1(HttpURLConnectionBackend.scala:290) ~[?:?]
at sttp.client4.SttpClientException$$anonfun$adjustExceptions$1.applyOrElse(SttpClientException.scala:35) ~[?:?]
at sttp.client4.SttpClientException$$anonfun$adjustExceptions$1.applyOrElse(SttpClientException.scala:34) ~[?:?]
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:38) ~[scala-library.jar:?]
at sttp.monad.MonadError.handleError(MonadError.scala:28) ~[?:?]
at sttp.monad.MonadError.handleError$(MonadError.scala:25) ~[?:?]
at sttp.monad.IdentityMonad$.handleError(MonadError.scala:175) ~[?:?]
at sttp.client4.SttpClientException$.adjustExceptions(SttpClientException.scala:34) ~[?:?]
at sttp.client4.httpurlconnection.HttpURLConnectionBackend.adjustExceptions(HttpURLConnectionBackend.scala:290) ~[?:?]
at sttp.client4.httpurlconnection.HttpURLConnectionBackend.send(HttpURLConnectionBackend.scala:33) ~[?:?]
at sttp.client4.httpurlconnection.HttpURLConnectionBackend.send(HttpURLConnectionBackend.scala:23) ~[?:?]
at sttp.client4.wrappers.FollowRedirectsBackend.sendWithCounter(FollowRedirectsBackend.scala:19) ~[?:?]
at sttp.client4.wrappers.FollowRedirectsBackend.send(FollowRedirectsBackend.scala:15) ~[?:?]
at sttp.client4.listener.ListenerBackend.$anonfun$send$4(ListenerBackend.scala:18) ~[?:?]
at scala.util.Try$.apply(Try.scala:213) ~[scala-library.jar:?]
at sttp.monad.MonadError.handleError(MonadError.scala:26) ~[?:?]
at sttp.monad.MonadError.handleError$(MonadError.scala:25) ~[?:?]
at sttp.monad.IdentityMonad$.handleError(MonadError.scala:175) ~[?:?]
at sttp.client4.listener.ListenerBackend.$anonfun$send$3(ListenerBackend.scala:18) ~[?:?]
at sttp.monad.syntax$MonadErrorOps.flatMap(MonadError.scala:63) ~[?:?]
at sttp.client4.listener.ListenerBackend.$anonfun$send$2(ListenerBackend.scala:21) ~[?:?]
at sttp.monad.IdentityMonad$.flatMap(MonadError.scala:178) ~[?:?]
at sttp.monad.syntax$MonadErrorOps.flatMap(MonadError.scala:63) ~[?:?]
at sttp.client4.listener.ListenerBackend.send(ListenerBackend.scala:16) ~[?:?]
at sttp.client4.Request.send(request.scala:159) ~[?:?]
at com.lumidion.sonatype.central.client.sttp.core.SyncSonatypeClient.uploadBundle(SyncSonatypeClient.scala:26) ~[?:?]
at xerial.sbt.sonatype.SonatypeCentralClient.$anonfun$uploadBundle$1(SonatypeCentralClient.scala:75) ~[?:?]
at scala.util.Try$.apply(Try.scala:213) ~[scala-library.jar:?]
at xerial.sbt.sonatype.SonatypeCentralClient.retryRequest(SonatypeCentralClient.scala:40) ~[?:?]
at xerial.sbt.sonatype.SonatypeCentralClient.uploadBundle(SonatypeCentralClient.scala:74) ~[?:?]
at xerial.sbt.sonatype.SonatypeCentralService.$anonfun$uploadBundle$6(SonatypeCentralService.scala:26) ~[?:?]
at scala.util.Either.flatMap(Either.scala:341) ~[scala-library.jar:?]
at xerial.sbt.sonatype.SonatypeCentralService.$anonfun$uploadBundle$3(SonatypeCentralService.scala:23) ~[?:?]
at scala.util.Either.flatMap(Either.scala:341) ~[scala-library.jar:?]
at xerial.sbt.sonatype.SonatypeCentralService.uploadBundle(SonatypeCentralService.scala:19) ~[?:?]
at xerial.sbt.Sonatype$.$anonfun$sonatypeCentralDeployCommand$1(Sonatype.scala:210) ~[?:?]
at xerial.sbt.Sonatype$.liftedTree1$1(Sonatype.scala:482) ~[?:?]
at xerial.sbt.Sonatype$.$anonfun$withSonatypeCentralService$2(Sonatype.scala:481) ~[?:?]
at scala.util.Either.flatMap(Either.scala:341) ~[scala-library.jar:?]
at xerial.sbt.Sonatype$.withSonatypeCentralService(Sonatype.scala:478) ~[?:?]
at xerial.sbt.Sonatype$.sonatypeCentralDeployCommand(Sonatype.scala:208) ~[?:?]
at xerial.sbt.Sonatype$.$anonfun$sonatypeBundleRelease$1(Sonatype.scala:239) ~[?:?]
at sbt.Command$.$anonfun$command$2(Command.scala:98) ~[command_2.12-1.9.6.jar:1.9.6]
at sbt.Command$.process(Command.scala:190) ~[command_2.12-1.9.6.jar:1.9.6]
at sbt.MainLoop$.$anonfun$processCommand$5(MainLoop.scala:246) ~[main_2.12-1.9.6.jar:1.9.6]
at scala.Option.getOrElse(Option.scala:189) ~[scala-library.jar:?]
at sbt.MainLoop$.process$1(MainLoop.scala:246) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.MainLoop$.processCommand(MainLoop.scala:277) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.MainLoop$.$anonfun$next$5(MainLoop.scala:164) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.State$StateOpsImpl$.runCmd$1(State.scala:290) ~[command_2.12-1.9.6.jar:1.9.6]
at sbt.State$StateOpsImpl$.process$extension(State.scala:326) ~[command_2.12-1.9.6.jar:1.9.6]
at sbt.MainLoop$.$anonfun$next$4(MainLoop.scala:164) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24) ~[util-control_2.12-1.9.6.jar:1.9.6]
at sbt.MainLoop$.next(MainLoop.scala:164) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.MainLoop$.run(MainLoop.scala:145) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:120) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.io.Using.apply(Using.scala:28) ~[io_2.12-1.9.1.jar:1.9.1]
at sbt.MainLoop$.runWithNewLog(MainLoop.scala:113) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.MainLoop$.runAndClearLast(MainLoop.scala:67) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:52) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.MainLoop$.runLogged(MainLoop.scala:43) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.StandardMain$.runManaged(Main.scala:225) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.xMain$.$anonfun$run$11(Main.scala:135) ~[main_2.12-1.9.6.jar:1.9.6]
at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62) ~[scala-library.jar:?]
at scala.Console$.withIn(Console.scala:230) ~[scala-library.jar:?]
at sbt.internal.util.Terminal$.withIn(Terminal.scala:610) ~[util-logging_2.12-1.9.6.jar:1.9.6]
at sbt.internal.util.Terminal$.$anonfun$withStreams$1(Terminal.scala:390) ~[util-logging_2.12-1.9.6.jar:1.9.6]
at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62) ~[scala-library.jar:?]
at scala.Console$.withOut(Console.scala:167) ~[scala-library.jar:?]
at sbt.internal.util.Terminal$.$anonfun$withOut$2(Terminal.scala:600) ~[util-logging_2.12-1.9.6.jar:1.9.6]
at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62) ~[scala-library.jar:?]
at scala.Console$.withErr(Console.scala:196) ~[scala-library.jar:?]
at sbt.internal.util.Terminal$.withOut(Terminal.scala:600) ~[util-logging_2.12-1.9.6.jar:1.9.6]
at sbt.internal.util.Terminal$.withStreams(Terminal.scala:390) ~[util-logging_2.12-1.9.6.jar:1.9.6]
at sbt.xMain$.withStreams$1(Main.scala:88) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.xMain$.run(Main.scala:123) ~[main_2.12-1.9.6.jar:1.9.6]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at sbt.internal.XMainConfiguration.run(XMainConfiguration.java:59) ~[main_2.12-1.9.6.jar:1.9.6]
at sbt.xMain.run(Main.scala:47) ~[main_2.12-1.9.6.jar:1.9.6]
at xsbt.boot.Launch$.$anonfun$run$1(Launch.scala:149) ~[sbt-launch.jar:1.4.2]
at xsbt.boot.Launch$.withContextLoader(Launch.scala:176) ~[sbt-launch.jar:1.4.2]
at xsbt.boot.Launch$.run(Launch.scala:149) ~[sbt-launch.jar:1.4.2]
at xsbt.boot.Launch$.$anonfun$apply$1(Launch.scala:44) ~[sbt-launch.jar:1.4.2]
at xsbt.boot.Launch$.launch(Launch.scala:159) [sbt-launch.jar:1.4.2]
at xsbt.boot.Launch$.apply(Launch.scala:44) [sbt-launch.jar:1.4.2]
at xsbt.boot.Launch$.apply(Launch.scala:21) [sbt-launch.jar:1.4.2]
at xsbt.boot.Boot$.runImpl(Boot.scala:78) [sbt-launch.jar:1.4.2]
at xsbt.boot.Boot$.run(Boot.scala:73) [sbt-launch.jar:1.4.2]
at xsbt.boot.Boot$.main(Boot.scala:21) [sbt-launch.jar:1.4.2]
at xsbt.boot.Boot.main(Boot.scala) [sbt-launch.jar:1.4.2]
Caused by: java.io.IOException: Error writing request body to server
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.checkError(HttpURLConnection.java:3737) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection$StreamingOutputStream.write(HttpURLConnection.java:3720) ~[?:?]
at java.io.InputStream.transferTo(InputStream.java:705) ~[?:?]
at java.nio.file.Files.copy(Files.java:3120) ~[?:?]
at sttp.client4.httpurlconnection.HttpURLConnectionBackend.writeBasicBody(HttpURLConnectionBackend.scala:132) ~[?:?]
at sttp.client4.httpurlconnection.HttpURLConnectionBackend.$anonfun$setMultipartBody$11(HttpURLConnectionBackend.scala:210) ~[?:?]
at sttp.client4.httpurlconnection.HttpURLConnectionBackend.$anonfun$setMultipartBody$11$adapted(HttpURLConnectionBackend.scala:203) ~[?:?
at scala.collection.immutable.List.foreach(List.scala:431) ~[scala-library.jar:?]
at sttp.client4.httpurlconnection.HttpURLConnectionBackend.setMultipartBody(HttpURLConnectionBackend.scala:203) ~[?:?]
at sttp.client4.httpurlconnection.HttpURLConnectionBackend.writeBody(HttpURLConnectionBackend.scala:105) ~[?:?]
at sttp.client4.httpurlconnection.HttpURLConnectionBackend.$anonfun$send$1(HttpURLConnectionBackend.scala:51) ~[?:?]
at scala.util.Try$.apply(Try.scala:213) ~[scala-library.jar:?]
at sttp.monad.MonadError.handleError(MonadError.scala:26) ~[?:?]
... 88 more
2025-04-10 09:31:37.139+0200 error [Sonatype] [BUNDLE_UPLOAD_FAILURE] Error uploading bundle to Sonatype Central. Exception when sending request: POST https://central.sonatype.com/api/v1/publisher/upload?publishingType=AUTOMATIC&name=io.kamon.kamon-2.7.6 - (Sonatype.scala:494)
Describe the bug
We moved to using Sonatype Central for publishing artifacts and several attempts to run
sonatypeBundleReleaseend with aBUNDLE_UPLOAD_FAILUREerror after about 30 seconds (see the logs below). The fact that it fails consistently at around 30 seconds makes me think that there has to be a timeout setting I have to tweak but I have no idea of which one should it be. This never happened before switching to Sonatype Central.The bundle was 347MB and after the failure I uploaded the bundle manually through the Sonatype Central UI and it accepted and validated the bundle, currently publishing.
How to reproduce the issue
Move to using Sonatype Central for publishing and try to
sonatypeReleaseBundlea huge bundle. Not common, but it happens to us with Kamon's publishing across all Scala versions.Additional context
Here are the logs from my last attempt: