Looks like TrimPath takes exception to having `{` `}` inside that statement, and using `{%` `%}` to enclose the statement instead results in TrimPath not knowing that the variable is declared