Variable substitution fails with NumberFormatException

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

If you are using a Bamboo variable to populate a script or function that expects a numerical value, but the Bamboo variable is not correctly referenced, the following will appear in the job log

1 Can't assign value '${variable}' to attribute <name>, reason: class java.lang.NumberFormatException with message 'For input string: "${variable}"

Cause

Bamboo variables need to have bamboo prepended to the variable name when passed to Tasks, for example

1 variable = ${bamboo.variable_name}

instead of

1 variable = ${variable_name}

If the identifier bamboo is not added, Bamboo will read this as a string, and not substitute the variable.

Resolution

Please ensure that the variable is correctly passed as ${bamboo.variable_name}.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.