Gradle "Publishing build scan failed" in CI
A build scan uploads after the build completes. When the upload to scans.gradle.com or a Develocity server fails, Gradle prints "Publishing build scan failed" but the build result itself is unaffected.
What this error means
At the end of the build, Gradle prints "Publishing build scan failed." with a cause such as a timeout or a rejected request, while the build tasks themselves succeeded.
Publishing build scan failed.
The response from https://scans.gradle.com/in/... was not from the build scan service.
java.net.SocketTimeoutException: Read timed outCommon causes
Restricted egress to the scan server
The runner cannot reach scans.gradle.com or the Develocity host, so the post-build upload times out.
A missing or invalid Develocity access key
For a self-hosted Develocity server, an absent GRADLE_ENTERPRISE_ACCESS_KEY / DEVELOCITY_ACCESS_KEY makes the publish request unauthorized.
How to fix it
Provide the Develocity access key
Inject the access key as an environment variable so the scan authenticates to your Develocity server.
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}Do not fail the build on scan upload
A scan is telemetry, not a build gate. Ensure the upload failure is not treated as a build failure, and allow egress to the scan host if scans are required.
./gradlew build --scan --no-daemonHow to prevent it
- Inject the Develocity access key from a CI secret for self-hosted scans.
- Allow egress to the scan host if scans are part of the workflow.
- Treat scan upload failures as non-fatal telemetry.