# \[email-ext plugin\] rooturl is always null

**URL:** <https://community.jenkins.io/t/email-ext-plugin-rooturl-is-always-null/13338>\
**Category:** Using Jenkins\
**Tags:** question, pipeline\
**Created:** [March 14, 2024, 2:44pm UTC](https://community.jenkins.io/t/email-ext-plugin-rooturl-is-always-null/13338 "2024-03-14T14:44:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gperrin](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/gperrin/32/7424_2.png) [@gperrin](https://community.jenkins.io/u/gperrin)\
**Post date:** [March 14, 2024, 2:44pm UTC](https://community.jenkins.io/t/email-ext-plugin-rooturl-is-always-null/13338/1 "2024-03-14T14:44:44Z")

</div>

Hi all,

I’m currently sending an email after some robot tests to give everyone the test results.  
In this email, I want to put a link to the runned job, so i can easily go to the concerned job.

I used this line :

`<td><A href="${rooturl}${build.url}">${rooturl}${build.url}</A></td>`

but I always got something like:  
nulljob/cp-robotframework-tests/job/controller/3044/

I have properly set up my Jenkins url in administration :

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/jenkins/original/2X/6/6ae1bf947ee4f44af4185d78987e6cc4667da91a.png)

yet it is always a null value.

Does anyone has an idea why ? Am I missing some configuration ?

Here is my Jenkins setup:

## Jenkins: 2.414.3 OS: Windows 10 - 10.0 Java: 11.0.4 - AdoptOpenJDK (OpenJDK 64-Bit Server VM)

Parameterized-Remote-Trigger:3.1.6.3  
ace-editor:1.1  
active-directory:2.34  
ant:475.vf34069fef73c  
antisamy-markup-formatter:159.v25b\_c67cd35fb\_  
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757  
artifactory:4.0.0  
authentication-tokens:1.4  
badge:1.9.1  
basic-branch-build-strategies:1.3.2  
blueocean:1.25.6  
blueocean-autofavorite:1.2.5  
blueocean-bitbucket-pipeline:1.25.6  
blueocean-commons:1.25.6  
blueocean-config:1.25.6  
blueocean-core-js:1.25.6  
blueocean-dashboard:1.25.6  
blueocean-display-url:2.4.1  
blueocean-events:1.25.6  
blueocean-git-pipeline:1.25.6  
blueocean-github-pipeline:1.25.6  
blueocean-i18n:1.25.6  
blueocean-jira:1.25.6  
blueocean-jwt:1.25.6  
blueocean-personalization:1.25.6  
blueocean-pipeline-api-impl:1.25.6  
blueocean-pipeline-editor:1.25.6  
blueocean-pipeline-scm-api:1.25.6  
blueocean-rest:1.25.6  
blueocean-rest-impl:1.25.6  
blueocean-web:1.25.6  
bootstrap4-api:4.6.0-5  
bootstrap5-api:5.3.0-1  
bouncycastle-api:2.28  
branch-api:2.1071.v1a\_188a\_562481  
build-timeout:1.21  
caffeine-api:3.1.8-133.v17b\_1ff2e0599  
checks-api:2.0.0  
cloudbees-bitbucket-branch-source:785.ve724eb\_44e286  
cloudbees-folder:6.858.v898218f3609d  
command-launcher:100.v2f6722292ee8  
commons-lang3-api:3.13.0-62.v7d18e55f51e2  
commons-text-api:1.10.0-36.vc008c8fcda\_7b\_  
config-file-provider:959.vcff671a\_4518b\_  
copyartifact:1.47  
credentials:1307.v3757c78f17c3  
credentials-binding:642.v737c34dea\_6c2  
dependency-track:4.2.0  
display-url-api:2.200.vb\_9327d658781  
docker-commons:1.19  
docker-workflow:521.v1a\_a\_dd2073b\_2e  
durable-task:500.v8927d9fd99d8  
echarts-api:5.4.0-5  
email-ext:2.102  
external-monitor-job:192.ve979ca\_8b\_3ccd  
favorite:2.4.1  
file-parameters:205.vf6ce13b\_e5dee  
font-awesome-api:6.4.0-1  
git:5.2.0  
git-client:4.5.0  
git-server:1.11  
github:1.37.3.1  
github-api:1.316-451.v15738eef3414  
github-branch-source:1677.v731f745ea\_0cf  
gitlab-api:5.1.0-84.v491924123a\_f7  
gitlab-branch-source:650.va\_d1ce6d01959  
gitlab-plugin:1.7.16  
gradle:1.39.4  
h2-api:1.4.199  
handlebars:3.0.8  
handy-uri-templates-2-api:2.1.8-22.v77d5b\_75e6953  
htmlpublisher:1.31  
instance-identity:173.va\_37c494ec4e5  
ionicons-api:56.v1b\_1c8c49374e  
ivy:2.2  
jackson2-api:2.15.3-372.v309620682326  
jakarta-activation-api:2.0.1-3  
jakarta-mail-api:2.0.1-3  
javadoc:226.v71211feb\_e7e9  
javax-activation-api:1.2.0-6  
javax-mail-api:1.6.2-9  
jaxb:2.3.9-1  
jdk-tool:66.vd8fa\_64ee91b\_d  
jenkins-design-language:1.25.6  
jersey2-api:2.41-133.va\_03323b\_a\_1396  
jira:3.7.1  
jjwt-api:0.11.5-77.v646c772fddb\_0  
job-dsl:1.81  
jquery-detached:1.2.1  
jquery3-api:3.7.0-1  
jsch:0.1.55.61.va\_e9ee26616e7  
junit:1240.vf9529b\_881428  
ldap:711.vb\_d1a\_491714dc  
lockable-resources:2.16  
mailer:463.vedf8358e006b\_  
matrix-auth:3.1.8  
matrix-project:818.v7eb\_e657db\_924  
maven-plugin:3.22  
mercurial:2.16.2  
mina-sshd-api-common:2.11.0-86.v836f585d47fa\_  
mina-sshd-api-core:2.11.0-86.v836f585d47fa\_  
momentjs:1.1.1  
okhttp-api:4.11.0-157.v6852a\_a\_fa\_ec11  
p4:1.13.0  
pam-auth:1.10  
pipeline-build-step:516.v8ee60a\_81c5b\_9  
pipeline-github-lib:38.v445716ea\_edda\_  
pipeline-graph-analysis:202.va\_d268e64deb\_3  
pipeline-groovy-lib:629.vb\_5627b\_ee2104  
pipeline-input-step:477.v339683a\_8d55e  
pipeline-milestone-step:101.vd572fef9d926  
pipeline-model-api:2.2114.v2654ca\_721309  
pipeline-model-definition:2.2114.v2654ca\_721309  
pipeline-model-extensions:2.2114.v2654ca\_721309  
pipeline-rest-api:2.34  
pipeline-stage-step:305.ve96d0205c1c6  
pipeline-stage-tags-metadata:2.2114.v2654ca\_721309  
pipeline-stage-view:2.34  
pipeline-utility-steps:2.16.0  
plain-credentials:143.v1b\_df8b\_d3b\_e48  
plugin-util-api:3.3.0  
popper-api:1.16.1-3  
popper2-api:2.11.5-2  
powershell:1.7  
pubsub-light:1.16  
resource-disposer:0.19  
robot:3.2.0  
run-condition:1.5  
scm-api:676.v886669a\_199a\_a\_  
script-security:1275.v23895f409fb\_d  
snakeyaml-api:2.2-111.vc6598e30cc65  
sonar:2.14  
sse-gateway:1.25  
ssh-credentials:308.ve4497b\_ccd8f4  
sshd:3.312.v1c601b\_c83b\_0e  
structs:325.vcb\_307d2a\_2782  
timestamper:1.18  
token-macro:384.vf35b\_f26814ec  
trilead-api:2.84.v72119de229b\_7  
tuleap-api:2.5.0  
tuleap-git-branch-source:3.2.5  
variant:59.vf075fe829ccb  
windows-slaves:1.8.1  
workflow-aggregator:590.v6a\_d052e5a\_a\_b\_5  
workflow-api:1283.v99c10937efcb\_  
workflow-basic-steps:991.v43d80fea\_ff66  
workflow-cps:3806.va\_3a\_6988277b\_2  
workflow-durable-task-step:1199.v02b\_9244f8064  
workflow-job:1360.vc6700e3136f5  
workflow-multibranch:716.vc692a\_e52371b\_  
workflow-scm-step:415.v434365564324  
workflow-step-api:639.v6eca\_cd8c04a\_a\_  
workflow-support:865.v43e78cc44e0d  
ws-cleanup:0.42

---

<div class="post-metadata">

**Author:** ![mawinter69](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/mawinter69/32/1625_2.png) [@mawinter69](https://community.jenkins.io/u/mawinter69)\
**Post date:** [March 14, 2024, 3:41pm UTC](https://community.jenkins.io/t/email-ext-plugin-rooturl-is-always-null/13338/2 "2024-03-14T15:41:09Z")

</div>

In case you use freestyle jobs then you might want to use `${BUILD_URL}` instead of `${rooturl}${build.url}`

In pipeline you should use `${currentBuild.absoluteUrl}`

---

<div class="post-metadata">

**Author:** ![gperrin](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/gperrin/32/7424_2.png) [@gperrin](https://community.jenkins.io/u/gperrin)\
**Post date:** [March 15, 2024, 11:00am UTC](https://community.jenkins.io/t/email-ext-plugin-rooturl-is-always-null/13338/3 "2024-03-15T11:00:12Z")

</div>

I’m using a multiple branch pipeline, not a freestyle job, so BUILD\_URL doesn’t seem a good solution.

However I tried currentBuild.absoluteUrl, which gives me this error :  
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: d21a4277-bcf8-44ad-a9b4-7b8becec0dc5 **11:55:47** java.lang.IllegalStateException: Root URL isn’t configured yet. Cannot compute absolute URL. **11:55:47** at hudson.model.Item.getAbsoluteUrl(Item.java:204) **11:55:47** at hudson.model.AbstractItem.getAbsoluteUrl(AbstractItem.java:594) **11:55:47** at hudson.model.Run.getAbsoluteUrl(Run.java:1070) **11:55:47** at org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper.getAbsoluteUrl(RunWrapper.java:378) **11:55:47** at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) **11:55:47** at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) **11:55:47** at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) **11:55:47** at java.base/java.lang.reflect.Method.invoke(Method.java:566) **11:55:47** at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98) **11:55:47** at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) **11:55:47** at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1845) **11:55:47** at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3773) **11:55:47** at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:195) **11:55:47** at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:469)  
…

Yet my URL seems alright in the configuration…

---

<div class="post-metadata">

**Author:** ![mawinter69](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/mawinter69/32/1625_2.png) [@mawinter69](https://community.jenkins.io/u/mawinter69)\
**Post date:** [March 15, 2024, 11:25am UTC](https://community.jenkins.io/t/email-ext-plugin-rooturl-is-always-null/13338/4 "2024-03-15T11:25:12Z")

</div>

`BUILD_URL` should also be available in pipeline jobs I just noticed.

But the stacktrace you get indicates that the Jenkins url is not properly set for some reason in the global config. You should check the jenkins logs if there is a message `Invalid URL received: <url>, considered as null`

---

<div class="post-metadata">

**Author:** ![gperrin](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/gperrin/32/7424_2.png) [@gperrin](https://community.jenkins.io/u/gperrin)\
**Post date:** [March 15, 2024, 1:25pm UTC](https://community.jenkins.io/t/email-ext-plugin-rooturl-is-always-null/13338/5 "2024-03-15T13:25:11Z")

</div>

I don’t have the error you’re talking about, but instead I have this:  
Found invalid crumb. If you are calling this URL with a script, please use the API Token instead. More information: [https://www.jenkins.io/redirect/crumb-cannot-be-used-for-script](https://www.jenkins.io/redirect/crumb-cannot-be-used-for-script)

Mar 15, 2024 1:14:04 PM WARNING hudson.security.csrf.CrumbFilter doFilter

Not really sure how it is linked, but I got it only when I use absoluteUrl

In the same time, I’m trying BUILD\_URL once more

---

<div class="post-metadata">

**Author:** ![gperrin](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/gperrin/32/7424_2.png) [@gperrin](https://community.jenkins.io/u/gperrin)\
**Post date:** [March 15, 2024, 4:13pm UTC](https://community.jenkins.io/t/email-ext-plugin-rooturl-is-always-null/13338/6 "2024-03-15T16:13:12Z")

</div>

Finally BUILD\_URL did the trick.  
I just got to get it from env var at the beginning of my template using

```auto
import hudson.model.Build
def BUILD_URL = build.getEnvironment(TaskListener.NULL)["BUILD_URL"];

```

Thanks for your guidelines on where to look !

---

<div class="post-metadata">

**Author:** ![danielbeck](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/danielbeck/32/89_2.png) [@danielbeck](https://community.jenkins.io/u/danielbeck)\
**Post date:** [March 15, 2024, 9:30pm UTC](https://community.jenkins.io/t/email-ext-plugin-rooturl-is-always-null/13338/7 "2024-03-15T21:30:19Z")

</div>

Or just `env.BUILD_URL`.
