Branch variables not listing variables from plan
Asked by David:

I'm trying to create a plan branch and override the plan variables. However, the variables are not being correctly listed. Instead, I see a list of blank selections with non-selectable titles "variables.groupby." which repeats down the list.

If I select one of these blank variable name I just get the error: "you must enter a valid key"

I saw some interesting errors in my atlassian-bamboo.log in my bamboo-home directory:

```
FreeMarker template error:
The following has evaluated to null or missing:
==> itemValue [in template "template/simple/select.ftl" at line 128, column 15]

----
FTL stack trace ("~" means nesting-related):
 - Failed at: ${itemValue?html} [in template "template/simple/select.ftl" at line 128, column 13]
 - Reached through: @ww.iterator value="parameters.list" [in template "template/simple/select.ftl" at line 66, column 5]
----
```

There were several other similar ones above this error message all complaining about a var that is null or missing in select.ftl:

```
----
FTL stack trace ("~" means nesting-related):
 - Failed at: #assign groupLabel = stack.findValue(... [in template "template/simple/select.ftl" at line 69, column 21]
 - Reached through: @ww.iterator value="parameters.list" [in template "template/simple/select.ftl" at line 66, column 5]
----

FTL stack trace ("~" means nesting-related):
 - Failed at: #assign itemKey = stack.findValue(par... [in template "template/simple/select.ftl" at line 89, column 17]
 - Reached through: @ww.iterator value="parameters.list" [in template "template/simple/select.ftl" at line 66, column 5]
----

----
FTL stack trace ("~" means nesting-related):
 - Failed at: #assign itemKeyStr = itemKey.toString() [in template "template/simple/select.ftl" at line 93, column 13]
 - Reached through: @ww.iterator value="parameters.list" [in template "template/simple/select.ftl" at line 66, column 5]
----

----
FTL stack trace ("~" means nesting-related):
 - Failed at: #assign itemValue = stack.findString(... [in template "template/simple/select.ftl" at line 95, column 17]
 - Reached through: @ww.iterator value="parameters.list" [in template "template/simple/select.ftl" at line 66, column 5]
----

----
FTL stack trace ("~" means nesting-related):
 - Failed at: ${itemKeyStr?html} [in template "template/simple/select.ftl" at line 111, column 24]
 - Reached through: @ww.iterator value="parameters.list" [in template "template/simple/select.ftl" at line 66, column 5]
----

----
FTL stack trace ("~" means nesting-related):
 - Failed at: #if tag.contains(parameters.nameValue... [in template "template/simple/select.ftl" at line 121, column 13]
 - Reached through: @ww.iterator value="parameters.list" [in template "template/simple/select.ftl" at line 66, column 5]
----
```

The file that appears to be problematic is located in C:\\Program Files\\Bamboo\\atlassian-bamboo\\template\\simple\\select.ftl.

I have tried running the re-index in Bamboo, re-installing Bamboo 6.4 (running latest Atlassian Bamboo version 6.4.0 build 60404 - 17 Feb 18) including restarting the service and the server. I am running Bamboo Server on Windows 2012R2.

Screenshot of issue:

![Capture.PNG](/t5/image/serverpage/image-id/16188iFE200D8FC04D38C8/image-size/large?v=v2&px=999 "Capture.PNG")


Answers:
author: David
body: I found a workaround today: the variables correctly listed when I deleted all of the plan variables and global variables. I first tried deleting only the plan variables but it was only until I also deleted the global variables and started re-adding variables did they start to list properly in the branch variables section.


author: Jeremy Owen
body: Nice find David!

For what it's worth, we've tracked down the bug that causes it and it relates to having a variable with a value in the format *${something}* which can't be expanded by Bamboo (e.g. not a reserved Bamboo variable that it can successfully substitute).

It's likely that you cleared out a variable with that value when you deleted your Global Variables and worked around it.

The bug report can be found below:

* [BAM-19969: Invalid nested variables in Plan Variables cause Freemarker error on Branch Variables page](https://jira.atlassian.com/browse/BAM-19969)

Cheers,

Jeremy