# Run Complete with status:Crash

**URL:** <https://community.openfn.org/t/run-complete-with-status-crash/437>\
**Category:** Job Writing\
**Created:** [May 8, 2024, 7:52pm UTC](https://community.openfn.org/t/run-complete-with-status-crash/437 "2024-05-08T19:52:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kiefer](https://community.openfn.org/letter_avatar_proxy/v4/letter/k/8e7dd6/32.png) [@Kiefer](https://community.openfn.org/u/Kiefer)\
**Post date:** [May 8, 2024, 7:52pm UTC](https://community.openfn.org/t/run-complete-with-status-crash/437/1 "2024-05-08T19:52:48Z")

</div>

Good Day,

While running my workflow i suddenly got this error.

 ![Screenshot 2024-05-08 151114](https://community.openfn.org/uploads/default/original/1X/cd216b870b782290713449221f2b0b101258b809.png)

This job was working previously and i made no changes to the code. However after creating a new workflow with the same code it works fine.

I am running lightning via docker locally. Any idea as to what the cause of this would be?

---

<div class="post-metadata">

**Author:** ![aleksa-krolls](https://community.openfn.org/user_avatar/community.openfn.org/aleksa-krolls/32/156_2.png) [@aleksa-krolls](https://community.openfn.org/u/aleksa-krolls)\
**Post date:** [May 9, 2024, 5:03am UTC](https://community.openfn.org/t/run-complete-with-status-crash/437/2 "2024-05-09T05:03:10Z")

</div>

Hey @Kiefer check out this Docs page on [Run Status Codes](https://community.openfn.org/t/run-complete-with-status-crash/437). Given your screenshot error `Unexpected token`, my guess is there is a syntax error in your job code. Maybe a character was missed or added if you copied/pasted from elsewhere?

 ![Screenshot 2024-05-09 at 7.59.21 AM](https://community.openfn.org/uploads/default/original/1X/7d3504d70c1edd4a712d3c1ee3260f2b1ce83dce.png)

Feel free to share your job code if you want another set of eyes to take a look and see if we can spot the issue.

---

<div class="post-metadata">

**Author:** ![Kiefer](https://community.openfn.org/letter_avatar_proxy/v4/letter/k/8e7dd6/32.png) [@Kiefer](https://community.openfn.org/u/Kiefer)\
**Post date:** [May 9, 2024, 1:10pm UTC](https://community.openfn.org/t/run-complete-with-status-crash/437/3 "2024-05-09T13:10:29Z")

</div>

This is the code i used. The job simply pulls the following data from a PSQL database.

Again the code worked previously and no changes were made to it.

sql(  
state =\>  
'Select patientid,fk\_cities, countryid\_fk, pfirstname, pmiddlename, plastname, dateofbirth, genderid, address, healthdistrictid, telephone, personalid, title, professionid, placeofwork, email, vaccinationid, pcode from postgres.patients Order by patients.patientid ASC LIMIT 10; ', { writeSql: true });

//use “OFFSET to skip records to allow job to run faster”

fn(state =\> {  
const patients = state.data;  
console.log(state);  
return {…state, patients};

});

---

<div class="post-metadata">

**Author:** ![joe](https://community.openfn.org/user_avatar/community.openfn.org/joe/32/75_2.png) [@joe](https://community.openfn.org/u/joe)\
**Post date:** [May 9, 2024, 1:58pm UTC](https://community.openfn.org/t/run-complete-with-status-crash/437/4 "2024-05-09T13:58:16Z")

</div>

Hi @Kiefer,

I am suspicious of the comment in your code:

```auto
//use “OFFSET to skip records to allow job to run faster”

```

Maybe it’s a formatting thing from the Community editor, but ` “` is not a valid Javascript character, which results in a syntax error. Try removing those quotes or using regular `"` characters

---

<div class="post-metadata">

**Author:** ![aleksa-krolls](https://community.openfn.org/user_avatar/community.openfn.org/aleksa-krolls/32/156_2.png) [@aleksa-krolls](https://community.openfn.org/u/aleksa-krolls)\
**Post date:** [May 10, 2024, 2:55pm UTC](https://community.openfn.org/t/run-complete-with-status-crash/437/5 "2024-05-10T14:55:05Z")

</div>

Hey @Kiefer - Thanks for the call today to walk through your workflow issue. Has it popped up again?

Also, I think you said you’re on lightning `v2.3.1`… this is a few versions behind. Can you please try upgrading to the latest version `v2.4.6` to see if this corrects the issue?

FYI @joe the weird thing was

1. Even if Kiefer was had a plain old `fn(...)` job expression, the job was still crashing with an `Unexpected token` error (see screenshot). But this issue was something wrong with this specific workflow!
2. If Kiefer created a new workflow and copied over the _exact_ job code over to the new workflow… it worked beautifully. Smells like bug.  
 ![Screenshot 2024-05-10 at 5.49.21 PM](https://community.openfn.org/uploads/default/original/1X/ad32746a4a409ae298858fe1b118d8a378f8b015.png)

Kiefer, I’ll share the video recording with the team… but I know they’ll advise that you get on the latest version of Lightning, so pls be sure to do that and then keep us posted if this pops up again. Thanks for your help sleuthing this!
