Missing [;] or [line feed] after expression

code is:

// first see if we have an image and if we do write it
if(structKeyExists(rc,“image”)) and len(rc.image){
uploadFile = fileUpload("/userFiles", rc.image, " ", “makeunique”);
writeDump var=uploadFile, abort=1

I’ve tried it the traditional way with parens () too and always get the same error. What’s the right way to do this? Has to be common in cfcs right? Is it the file upload? The write dump? The syntax? I see this in a feew posts but haven’t found a definitive answer, seems to be related to how lucee parses scripts.

The error should have a line number in the tag context that tells you want line is at fault.

writeDump var=uploadFile, abort=1

This is not valid. writeDump() is a function call and needs parens. You’re trying to treat it as a tag. But even if it were, you’d need a semicolon at the end.

Aren’t semicolons meant to be somewhat optional?

I can’t quite remember the name for the rules about optional semicolons, but surely a } implies a ; ?

Not for the tag-in-script syntax. Otherwise, there would be ambiguity in code like this:


Where does the cfmail tag end and the random variable sets begin. Lucee wouldn’t know without a semocolon.

Ok, so this is my specific point, and I mentioned that I tried the TRADITIONAL methods with PARENS AKA parenthesis. This includes with and without semi-colons. So I’ve tried “ECMA Script Syntax” and “Modified Tag Syntax”.

First line of error.

Template: D:\healdfamily\handlers\inventory.cfc
LINE: 55: 56: // first see if we have an image and if we do write it 57: if(structKeyExists(rc,“image”)) and len(rc.image){ 58: 59: uploadFile = fileUpload("/userFiles", rc.image, " ", “makeunique”);

Nothing wrong there…

Again full code block.

And to be clear, I’ve created a full featured app that meets crazy expectations in no time. I know I we will find a work around.

I’m sorry if I’m somewhat aggressive sometimes.

// first see if we have an image and if we do write it

    if(structKeyExists(rc,"image")) and len(rc.image){

        uploadFile = fileUpload("/userFiles", rc.image, " ", "makeunique");




I’ve tried named attributes too.

New line or next safe word?

Brad, I don’t know you personally but we have many secondary and tertiary contacts. I have no problem giving you full access to show me how to do it, but I’m not doing that in public.

If you’ve not already fixed it’s the if; change

 if(structKeyExists(rc,"image")) and len(rc.image){


 if(structKeyExists(rc,"image") and len(rc.image)){

I was referring to the closing brace?

There are three basic rules of semicolon insertion:

  1. When, as the program is parsed from left to right, a token (called the offending token) is encountered that is not allowed by any production of the grammar, then a semicolon is automatically inserted before the offending token if one or more of the following conditions is true:
  • The offending token is separated from the previous token by at least one LineTerminator.
  • The offending token is }.

You sir are a god among men.


No, Lucee does not put an implicit semocolon before a closing brace

Perhaps it would be a good idea, but CFML is also not ECMA script, or at least doesn’t follow all its rules

New line or next safe word?

In CFML whitespace is not taken into consideration in the parser. You can put as many line breaks as you wish into any tag or function call. Therefore, it cannot be used to tell when your tag is ended. There is also no such safe word. Perhaps in a more strict language like Java, but in CFML how would the parser know the difference between

content reset=true;



if you wrote it like so:

// or even ...
content reset=true

The token reset is not safe at all since the ambiguity still exists. It could be either an attribute to the tag or an unrelated variable set. Therefore, in Lucee’s generic “tag-in-script” syntax it reads until it finds the next semicolon. If it doesn’t find one, it errors.

Adobe is moving in the ECMA script direction, I think the specific rule about the closing brace would be ok, but could also be confusing… Lucee has bigger syntax problems to fry

totally agree that the whitespace rules shouldn’t apply.

They SAY that, but they also have yet to define what the heck it even means. I’m 98% sure they have no clue what it means and they stuck it on a conference slide because it looked good and someone mentioned it in a forum. Adobe would need to break compatibility to turn cfscript into a fully ECMA compliant language and that would be a pretty stupid and worthless venture in my opinion. I’m pretty sure the ACF 2021 release showed us what they will end up doing-- and it was basically them randomly grabbing a few ideas from JavaScript and tacking them onto CFScript. And that, I’m fine with-- so long as the ideas they borrow actually make sense in CFML.

Sorry, a question that I think is on topic.

Is it correct that cffile without a semicolon at the end raise an exception?


cffile( action="append" file="myFile" output="myOutput");

Not works:

cffile( action="append" file="myFile" output="myOutput")

with this error:

Syntax Error, Invalid Construct

Many thanks