Createfile failed after writing 156 lines

Hello, I am just testing this function like this
createfile until __endoffile
…few hundred lines…

But then I see that it failed! 156 lines have “completed” and then 157th says failed!
Is this function limited to only write some amount of data or what is this?

I have createfile commands running beyond 156 lines. My largest right now is 865 lines and it works like a champ. You should take a look at the client logs on the machine you are running the action against to get more details of what failed. Feel free to post what you find here.

If there is an error anywhere inside the createfile (like a relevance statement in error), the error message always shows up on the last line in the console log.

You might get more detail from the client log instead.

Excuse me but I don’t understand what you mean by error inside the createfile. How can this function care about what is it writing to a file??

logfile on client:
Command failed (Substitution failed while writing file) createfile until __endoffile (action:151248)

If the content contains { }, that is taken to be a Relevance Substitution. If there is an error in the relevance (or it’s not Relevance at all) it yields a relevance Substitution error.

If it’s not Relevance, you d to escape the brackets by changing ,{ to {{

it’s a powershell code so yes. I see it failed on the line containing {
Don’t you think it would be great if this behavior was actually documented here? :slight_smile: I had no idea about this
https://developer.bigfix.com/action-script/reference/file/createfile-until.html

A quick search of this forum finds:

1 Like

It’s a good point. We should update the ‘createfile’ documentation to include a note warning about the potential need to escape curly braces, and provide an example as well.

Agreed. There is example usage at https://developer.bigfix.com/action-script/guide/substitution.html for more detail on the usage; it would be useful to link this from the createfile and appendfile documentation.

1 Like

if I had any idea something might need escaping, I would search for it yes :smiley:
thanks for updating it Aram

Thanks for mentioning this. I ran into the exact same issue.

Can I just escape all left and right curly braces to be safe? I have a Powershell script where I’m using createfile and there are a ton of both left and right curly brackets, sometimes embedded multiple levels. I tried escaping all left curly brackets but that didn’t solve the issue.

I wish there was a way to escape an entire line so I don’t have to worry about it at all?

If there are no relevance substitutions intended, escape all the opens as {{ and none of the closes (they remain } ).

I usually do a find/replace all in notepad or notepad++ before pasting it into ActionScript.

1 Like

Thanks, Jason! I’ll do that.

I realized my own issue: I didn’t sync components in my baseline. When I escaped all of the left curly brackets in my task, the baseline doesn’t use the new version so that’s why my second attempt failed. I’m still a Bigfix newbie. :sweat_smile:

1 Like

Thank you for this! I only wasted a day!

Mixing toolsets and environments? It’s character escaping all the way down.

1 Like