title: Server error with HtmlService template, debugging shows nothing
body: <p>I have an HTML template in my Apps Script project that I am trying to evaluate. I keep getting a server error (not very helpful), but I can't find anything while debugging. I tried the running result from getCode(), but no errors there. Then I also ran output.$out.getContent() (as described here <a href="https://developers.google.com/apps-script/html_service" rel="nofollow noreferrer">https://developers.google.com/apps-script/html_service</a>) which gives me the expected html output.</p>
  <p>I would attach the HTML file but it contains a lot of variables and I have trouble creating a lean version with the error. I am hoping someone knows a better or the right way to debug these files.</p>
  <p>The html file:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;html&gt;
    &lt;body&gt;
      &lt;form action=&quot;https://script.google.com/macros/s/AKfycbxHQDJoAtAjBF9uIctvmxBHv-QVpYf6f15UZf8aAnAh_1U_PzU/exec&quot; method=&quot;POST&quot; id=&quot;mail-form&quot;&gt;
        &lt;table&gt;
          &lt;tr style=&quot;background-color: #392303; font-size: large; line-height: 30px;&quot;&gt;
            &lt;th&gt;
              &lt;a href=&quot;&lt;?= info.profile ?&gt;&quot; style=&quot;color: #e06c01; font-weight: lighter;&quot;&gt;&lt;?= userForm.userName ?&gt;&lt;/a&gt;
            &lt;/th&gt; 
            &lt;th colspan=&quot;3&quot;&gt; 
              &lt;div width=&quot;250px&quot; style=&quot;color: #e06c01; font-weight: lighter; float: left; text-indent: 10px;&quot;&gt;&lt;?= userForm.experience ?&gt;&lt;/div&gt; 
              &lt;div style=&quot;color: #FFFFFF; background-color: &lt;?= userForm.pastColor ?&gt;; border: 1px solid white; width: 28px; height: 28px; float: right;&quot; title=&quot;&lt;?= userForm.pastApplications ?&gt;&quot;&gt;
                &lt;center&gt;&lt;?= userForm.pastNumber ?&gt;&lt;/center&gt; 
              &lt;/div&gt;
            &lt;/th&gt; 
          &lt;/tr&gt;
          &lt;tr style=&quot;background-color: #9c9181&quot;&gt; 
            &lt;td width=&quot;100&quot;&gt;
              &lt;center&gt;&lt;p style=&quot;font-size:small; top: 5px; margin-bottom: 3px;&quot;&gt;Thanks meter: &lt;?= info.thanks ?&gt;&lt;/p&gt;&lt;/center&gt; 
              &lt;center&gt;&lt;img alt=&quot;&quot; src=&quot;&quot; style=&quot;margin-bottom: 10px;&quot;/&gt;&lt;/center&gt; 
              &lt;center&gt;&lt;img src=&quot;&lt;?= info.avatar ?&gt;&quot; style=&quot;height: 60px; margin-bottom: 10px;&quot; /&gt;&lt;/center&gt; 
              &lt;center&gt;&lt;p style=&quot;font-size:small; margin-bottom: 3px; margin-top: 3px;&quot;&gt;Posts: &lt;?= info.totalPosts ?&gt;&lt;/p&gt;&lt;/center&gt; 
              &lt;center&gt;&lt;p style=&quot;font-size:small; margin-bottom: 3px; margin-top: 3px;&quot;&gt;Per day: &lt;?= info.postsPerDay ?&gt;&lt;/p&gt;&lt;/center&gt; 
              &lt;center&gt;&lt;p style=&quot;font-size:small; margin-bottom: 3px; margin-top: 3px;&quot;&gt;Join date: &lt;?= info.joinDate ?&gt;&lt;/p&gt;&lt;/center&gt; 
              &lt;center&gt;&lt;p style=&quot;font-size:small; margin-bottom: 3px; margin-top: 3px;&quot;&gt;Last activity: &lt;?= info.activity ?&gt;&lt;/p&gt;&lt;/center&gt;
            &lt;/td&gt; 
            &lt;td&gt;
              &lt;center&gt;&lt;?= userForm.onSite ?&gt;&lt;/center&gt;
            &lt;/td&gt; 
            &lt;td&gt;
              &lt;center&gt;&lt;?= userForm.tools + '\n' + '\n' + userForm.theHardPart ?&gt;&lt;/center&gt;
            &lt;/td&gt; 
            &lt;td width=&quot;100&quot;&gt;
              &lt;center&gt;&lt;?= userForm.development ?&gt;&lt;/center&gt;
            &lt;/td&gt; 
          &lt;/tr&gt;
          
          &lt;tr style=&quot;background-color: #392303; font-size: large; line-height: 30px;&quot;&gt;
            &lt;td colspan=&quot;4&quot; style=&quot;color: #e06c01; font-weight: lighter; text-indent: 10px;&quot;&gt;Review&lt;/td&gt;
          &lt;/tr&gt;
          
          &lt;tr style=&quot;background-color: #9c9181&quot;&gt;
            &lt;td colspan=&quot;1&quot; valign=&quot;top&quot;&gt;
              &lt;label&gt;&lt;input type=&quot;radio&quot; name=&quot;review&quot; value=&quot;approved&quot; id=&quot;review_1&quot;&gt;Accept&lt;/label&gt;
            &lt;/td&gt;
            &lt;td colspan=&quot;1&quot; valign=&quot;top&quot;&gt;
              &lt;label&gt;&lt;input type=&quot;radio&quot; name=&quot;review&quot; value=&quot;rejected&quot; id=&quot;review_2&quot;&gt;Reject&lt;/label&gt;&lt;br&gt;&lt;br&gt;
              &lt;label&gt;&lt;b&gt;Reason(s) for user&lt;/b&gt;&lt;/label&gt;&lt;br&gt;
              &lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;reason&quot; value=&quot;Reason1&quot; id=&quot;requirements&quot;&gt;Reason1&lt;/label&gt;&lt;br&gt;
              &lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;reason&quot; value=&quot;Reason2&quot; id=&quot;requirements&quot;&gt;Reason2&lt;/label&gt;&lt;br&gt;
              &lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;reason&quot; value=&quot;Reason3&quot; id=&quot;requirements&quot;&gt;Reason&lt;/label&gt;&lt;br&gt;
              &lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;reason&quot; value=&quot;Reason4&quot; id=&quot;requirements&quot;&gt;Reason4&lt;/label&gt;&lt;br&gt;
              &lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;reason&quot; value=&quot;Reason5&quot; id=&quot;requirements&quot;&gt;Reason5&lt;/label&gt;&lt;br&gt;
              &lt;label&gt;&lt;input type=&quot;checkbox&quot; name=&quot;reason&quot; value=&quot;Reason6&quot; id=&quot;requirements&quot;&gt;Reason6&lt;/label&gt;&lt;br&gt;
            &lt;/td&gt;
            &lt;td colspan=&quot;1&quot; style=&quot;text-indent: 3px;&quot;&gt;
              &lt;label&gt;&lt;b&gt;Feedback&lt;/b&gt;&lt;/label&gt;&lt;br&gt;
              &lt;label&gt;&lt;i&gt;Rejections:&lt;/i&gt; &lt;b&gt;WARNING&lt;/b&gt; users will see this&lt;/label&gt;&lt;br&gt;
              &lt;label&gt;&lt;i&gt;Approvals:&lt;/i&gt; only for us&lt;/label&gt;&lt;br&gt;
              &lt;textarea name=&quot;comments&quot; rows=&quot;10&quot; cols=&quot;35&quot; id=&quot;comments&quot;&gt;&lt;/textarea&gt;
            &lt;/td&gt;
          &lt;/tr&gt;        
        &lt;/table&gt;
        
        &lt;input type=&quot;hidden&quot; name=&quot;userName&quot; id=&quot;userName&quot; value=&quot;&lt;?= userForm.userName ?&gt;&quot;/&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;reviewerName&quot; id=&quot;reviewerName&quot; value=&quot;&lt;?= userForm.reviewer ?&gt;&quot;/&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;link&quot; id=&quot;link&quot; value=&quot;&lt;?= info.profile ?&gt;&quot;/&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;row&quot; id=&quot;row&quot; value=&quot;&lt;?= userForm.row ?&gt;&quot;/&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;hash&quot; id=&quot;hash&quot; value=&quot;&lt;?= userForm.hash ?&gt;&quot;/&gt;
        
        &lt;div&gt;
          &lt;div style=&quot;float: left;&quot;&gt;
            &lt;input type=&quot;submit&quot; name=&quot;submit&quot; id=&quot;submit&quot; value=&quot;Submit&quot;&gt;
          &lt;/div&gt;
          &lt;div style=&quot;float: right;&quot;&gt;
            &lt;a href=&quot;mailto:&lt;?= mailTo ?&gt;?subject=&lt;?= subject ?&gt;&amp;body=&lt;?= body ?&gt;&quot;&gt; 
              &lt;b&gt;Consult&lt;/b&gt;
            &lt;/a&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        
      &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>The relevant part of the script:</p>
  <pre><code>  var htmlTemplate = HtmlService.createTemplateFromFile('DC Form');
    htmlTemplate.userForm = userForm;
    htmlTemplate.info = info;
    htmlTemplate.mailTo = mailTo;
    htmlTemplate.subject = 'CONSULT: ' + userForm.userName;
    htmlTemplate.body = 'Profile link: ' + userForm.profile + '\n' + '\n';
    var code = htmlTemplate.getCode();
    Logger.log(code);
    var html = htmlTemplate.evaluate().getContent();
  </code></pre>
  <p>EDIT:</p>
  <p>After using the Caja Playground I found an error in this line:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;div style=&quot;color: #FFFFFF; background-color: &lt;?= userForm.pastColor ?&gt;; border: 1px solid white; width: 28px; height: 28px; float: right;&quot; title=&quot;&lt;?= userForm.pastApplications ?&gt;&quot;&gt;
  </code></pre>
  <p>Could it be that using scriptlets inside attributes isn't supported?</p>