How to debug build scan link exception

I’m trying to run the latest trunk Kafka gradle build using Gradle Enterprise 3.14.1 and I’m getting an exception about build scan links. The kafka build doesn’t explicitly set any links itself, so it seems to be something automatically added by the plugin. How can I tell what link is failing?

Updating to Develocity 3.17 has the same issue, upper exception stacktrace is:

  • Exception is:
    com.gradle.develocity.agent.gradle.internal.b.a: Build scan custom link url cannot be null.
    at com.gradle.scan.plugin.internal.c.ah.j.c(SourceFile:34)
    at com.gradle.scan.plugin.internal.c.ah.j.b(SourceFile:27)
    at com.gradle.develocity.agent.gradle.internal.scan.f.link(SourceFile:106)
    at com.gradle.enterprise.gradleplugin.internal.extension.e.link(SourceFile:127)
    at com.gradle.enterprise.gradleplugin.internal.extension.c.a(SourceFile:44)
    at com.gradle.enterprise.gradleplugin.internal.extension.c.a(SourceFile:39)
    at com.gradle.enterprise.gradleplugin.internal.extension.b.link(SourceFile:98)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:541)
    at org.gradle.internal.metaobject.BeanDynamicObject.tryInvokeMethod(BeanDynamicObject.java:218)
    at org.gradle.internal.metaobject.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:163)
    at com.gradle.enterprise.gradleplugin.internal.extension.b_Decorated.invokeMethod(Unknown Source)
    at org.gradle.kotlin.dsl.GroovyBuilderScopeForGroovyObject.invoke(GroovyInteroperability.kt:277)
    at Build_scan_gradle$configureExtension$1$1.invoke(build-scan.gradle.kts:25)
    at Build_scan_gradle$configureExtension$1$1.invoke(build-scan.gradle.kts:11)
    at org.gradle.kotlin.dsl.GroovyBuilderScope$closureFor$1.doCall(GroovyInteroperability.kt:330)
    at jdk.internal.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.gradle.util.internal.ClosureBackedAction.execute(ClosureBackedAction.java:71)
    at org.gradle.util.internal.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
    at org.gradle.util.internal.ConfigureUtil.configure(ConfigureUtil.java:107)
    at org.gradle.util.internal.ConfigureUtil$WrappedConfigureAction.execute(ConfigureUtil.java:178)
    at com.gradle.enterprise.gradleplugin.internal.extension.a.buildScan(SourceFile:32)
    at com.gradle.enterprise.gradleplugin.internal.extension.d.buildScan(SourceFile:49)
    at com.gradle.enterprise.gradleplugin.internal.extension.d_Decorated.buildScan(Unknown Source)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:541)
    at org.gradle.internal.metaobject.BeanDynamicObject.tryInvokeMethod(BeanDynamicObject.java:218)
    at org.gradle.internal.metaobject.AbstractDynamicObject.invokeMethod(AbstractDynamicObject.java:163)
    at com.gradle.enterprise.gradleplugin.internal.extension.d_Decorated.invokeMethod(Unknown Source)
    at org.gradle.kotlin.dsl.GroovyBuilderScopeForGroovyObject.invoke(GroovyInteroperability.kt:277)
    at org.gradle.kotlin.dsl.GroovyBuilderScope$DefaultImpls.invoke(GroovyInteroperability.kt:247)
    at org.gradle.kotlin.dsl.GroovyBuilderScopeForGroovyObject.invoke(GroovyInteroperability.kt:270)
    at Build_scan_gradle.configureExtension(build-scan.gradle.kts:11)
    at Build_scan_gradle$1.execute(build-scan.gradle.kts:5)
    at Build_scan_gradle$1.execute(build-scan.gradle.kts:3)

As you stacktrace is coming from a file build-scan.gradle.kts which is not present in the Kafka repository, I guess this is coming from some init script you have on your local disk.

For debugging “what link” it is, you probably have to set a breakpoint to the method com.gradle.enterprise.gradleplugin.internal.extension.b.link to find out.

Maybe you could post a feature request to add the label to the error message.

Thanks! It was indeed a corporate init script in my ~/.gradle/init.d trying to add links based on unset/empty environment variables.

1 Like