Inline Script Task Save Fails for Large Scripts

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: High
    • 13.0.0, 12.1.7
    • Affects Version/s: 12.1.2, 12.1.6
    • Component/s: Tasks
    • None
    • 1
    • Severity 1 - Critical

      Issue Summary

      After upgrading from Bamboo 11.0.2 to 12.1.2, saving inline script tasks fails with a FreeMarker InvalidReferenceException when the script body exceeds the struts.multipart.maxStringLength limit. The script body is dropped by Struts before Bamboo processes it, causing the UI to report "You have to specify the script body."

      Steps to Reproduce

      1. Install Bamboo 12.1.2 (fresh or upgraded from 11.x)
      2. Create a new Plan with any Stage/Job
      3. Add an Inline Script task
      4. Paste a script body that exceeds ~300 lines / ~10 KB
      5. Click Save

      Expected Results

      Script saves successfully

      Actual Results

      Script body is wiped and throws error "You have to specify the script body" is displayed

      The below exception is thrown in the atlassian-bamboo.log file:

      2026-04-22 07:40:52,777 ERROR [http-nio-8085-exec-7 url: /bamboo/build/admin/edit/updateTask.action; user: admin] [runtime] Error executing FreeMarker template
      freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
      ==> name?eval[0]  [in template "template/simple/ace-textarea.ftl" at line 25, column 30]
      
      ----
      Tip: It's the final [] step that caused this error, not those before it.
      ----
      Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use [#if myOptionalVar??]when-present[#else]when-missing[/#if]. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
      ----
      
      ----
      FTL stack trace ("~" means nesting-related):
      	- Failed at: #assign editorValue = name?eval[0]  [in template "template/simple/ace-textarea.ftl" at line 25, column 9]
      	- Reached through: #include "/${attributes.templateDir}/...  [in template "template/aui/ace-textarea.ftl" at line 7, column 1]
      ----
      	at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
      	at freemarker.core.Assignment.accept(Assignment.java:139)
      	at freemarker.core.Environment.visit(Environment.java:344)
      	at freemarker.core.Environment.visit(Environment.java:350)
      	at freemarker.core.Environment.visit(Environment.java:350)
      	at freemarker.core.Environment.visit(Environment.java:350)
      	at freemarker.core.Environment.include(Environment.java:3139)
      	at freemarker.core.Include.accept(Include.java:171)
      	at freemarker.core.Environment.visit(Environment.java:344)
      	at freemarker.core.Environment.visit(Environment.java:350)
      	at freemarker.core.Environment.process(Environment.java:323)
      	at freemarker.template.Template.process(Template.java:383)
      	at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:152)
      	at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:610)
      	at org.apache.struts2.components.UIBean.end(UIBean.java:569)
      	at org.apache.struts2.views.freemarker.tags.CallbackWriter.afterBody(CallbackWriter.java:85)
      	at freemarker.core.Environment.visitAndTransform(Environment.java:512)
      	at freemarker.core.UnifiedCall.accept(UnifiedCall.java:103)
      	at freemarker.core.Environment.visit(Environment.java:380)
      	at freemarker.core.Environment.invokeMacroOrFunctionCommonPart(Environment.java:886)
      	at freemarker.core.Environment.invokeMacro(Environment.java:822)
      	at freemarker.core.UnifiedCall.accept(UnifiedCall.java:83)
      	at freemarker.core.Environment.visit(Environment.java:380)
      	at freemarker.core.Environment.invokeNestedContent(Environment.java:630)
      	at freemarker.core.BodyInstruction.accept(BodyInstruction.java:60)
      	at freemarker.core.Environment.visit(Environment.java:344)
      	at freemarker.core.Environment.visit(Environment.java:386)
      	at freemarker.core.Environment.invokeMacroOrFunctionCommonPart(Environment.java:886)
      	at freemarker.core.Environment.invokeMacro(Environment.java:822)
      	at freemarker.core.UnifiedCall.accept(UnifiedCall.java:83)
      	at freemarker.core.Environment.visit(Environment.java:344)
      	at freemarker.core.Environment.visit(Environment.java:350)
      	at freemarker.core.Environment.process(Environment.java:323)
      	at freemarker.template.Template.process(Template.java:383)
      	at com.atlassian.bamboo.ww2.BambooFreemarkerManager.renderPage(BambooFreemarkerManager.java:462)
      	at com.atlassian.bamboo.ww2.BambooFreemarkerManager.renderPage(BambooFreemarkerManager.java:395)
      	at com.atlassian.bamboo.ww2.BambooFreemarkerManager.renderTemplateToString(BambooFreemarkerManager.java:589)
      	at com.atlassian.bamboo.ww2.BambooFreemarkerManager.renderPage(BambooFreemarkerManager.java:364)
      

      Workaround

      Option 1

      To resolve this, increase the struts.multipart.maxStringLength value in your Bamboo configuration. Please follow the steps below for the same:

      1. Stop Bamboo
      2. Locate the file <bamboo-install>/atlassian-bamboo/WEB-INF/classes/struts.properties
      3. Look for the line:
        struts.multipart.maxStringLength=10240
        
      4. Change it to:
        struts.multipart.maxStringLength=102400
        

        This sets the limit to 100KB, which should comfortably accommodate even very large inline scripts.

      5. Restart Bamboo

      Option 2

      Use script location: File

              Assignee:
              Mateusz Szmal
              Reporter:
              Jyothi Charupalli
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: