Workflow triggered by Webhook seems to crash in the startTrigger phase

I have a workflow that processes prescription information.
Every 1 in 100 times it appears to crash at the start trigger block. I do not know why. Since it's in the start trigger, I'm not even sure how I would go about debugging this.
The webhook is called on submission of a Cognito form.
If I rerun the failed call, it continues to fail, implying there is something wrong with the JSON payload.


Hi @Tom_Burns, and welcome to the Community Forum!

On a failed run, can you check the Input tab and see what that payload looks like? That could help us debug what the issue is. Something else you could do is check the logs for a failed run and DM me the workflowrun ID as well as the workflow ID, and we can find some logs and see whats happening.

Starting run for workflow: dd91263c-4766-4167-a77d-5fde4d891328 in environment production
Mon 2025-06-02 11:53:47

Workflow Run Id: 01972e58-471a-7059-b15b-73bc39a98762

(Attachment failed_workflow.txt is missing)

{"value":{"Form":{"Id":"9","InternalName":"MedicationOrderPrescriptionDetailsCollection","Name":"Medication Order - Prescription Details Collection"},"YourDetails":{"Name":{"First":"Sylvia","FirstAndLast":"Sylvia Vaartjes","Last":"Vaartjes","Middle":null,"MiddleInitial":null,"Prefix":null,"Suffix":null},"OrderNumber":1000006,"PrescriptionUpload":[{"Id":"2Kdy5a","UploadPrescription":[{"ContentType":"image/heic","Id":"F-1Sc88btD$Yyr5xFA5iil5E","IsEncrypted":true,"Name":"IMG_3637.HEIC","Size":3517426,"StorageUrl":null,"File":"https://www.cognitoforms.com/fa/Fxbx7xmyuEaChkNBzbdYNg?token=ccFK2yLnLbp1JjMRHRYLV8uDi6iqhNm1l8D-EZLQKWp1eiXp54eCWgfKzL_M8-GdhHHWdPdtnHiUbPQJDu-Cmg$$"}],"PetName":"Fifi","ItemNumber":1}],"PrescriptionPostageDetails":{"HaveYouPostedYourOriginalPrescriptionsToPetChemistYet":true,"PleaseSelectOneOfTheFollowingOptionsThatBestApplies":null,"DidYouPostYourPrescriptionByRegisteredTrackedOrExpressPostrecommended":false,"TrackingNumberForPostedOriginalPrescription":null,"PostalTrackingNumber":null,"PhotoOfTrackingNumber":[],"HaveYouPostedYourOriginalPrescriptionsToPetChemistYet2":"Yes","PleaseSelectOneOfTheFollowingOptionsThatBestApplies_IsRequired":false},"HaveYouOrderedOneOfTheFollowingRestrictedMedications":"No","OrderNumber_Minimum":18,"OrderNumber_IncrementBy":1},"Entry":{"AdminLink":"https://www.cognitoforms.com/MadPaws1/9/entries/114818","DateCreated":"2025-06-02T01:53:44.146Z","DateSubmitted":"2025-06-02T01:53:44.146Z","DateUpdated":"2025-06-02T01:53:44.146Z","Number":114818,"Order":null,"Origin":{"City":null,"CountryCode":null,"IpAddress":"122.150.145.21","IsImported":false,"Region":null,"Timezone":null,"UserAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"},"Timestamp":"2025-06-02T01:53:44.146Z","User":null,"Version":1,"Action":"Submit","Role":"Public","Status":"Submitted","Document1":"https://www.cognitoforms.com/d/Fxbx7xmyuEaChkNBzbdYNg?code=ez0KE34sQNZJdcPqoXP5EiDQN5Zc4jwBzzwExXUW1O4$","Document2":"https://www.cognitoforms.com/d/Fxbx7xmyuEaChkNBzbdYNg?code=lRl3X53BUmIzQ11V240cqDKFUL2KAsVhhBz11vmKV7s$"},"Id":"9-114818"},"metadata":null,"data":{"Form":{"Id":"9","InternalName":"MedicationOrderPrescriptionDetailsCollection","Name":"Medication Order - Prescription Details Collection"},"YourDetails":{"Name":{"First":"Sylvia","FirstAndLast":"Sylvia Vaartjes","Last":"Vaartjes","Middle":null,"MiddleInitial":null,"Prefix":null,"Suffix":null},"OrderNumber":1000006,"PrescriptionUpload":[{"Id":"2Kdy5a","UploadPrescription":[{"ContentType":"image/heic","Id":"F-1Sc88btD$Yyr5xFA5iil5E","IsEncrypted":true,"Name":"IMG_3637.HEIC","Size":3517426,"StorageUrl":null,"File":"https://www.cognitoforms.com/fa/Fxbx7xmyuEaChkNBzbdYNg?token=ccFK2yLnLbp1JjMRHRYLV8uDi6iqhNm1l8D-EZLQKWp1eiXp54eCWgfKzL_M8-GdhHHWdPdtnHiUbPQJDu-Cmg$$"}],"PetName":"Fifi","ItemNumber":1}],"PrescriptionPostageDetails":{"HaveYouPostedYourOriginalPrescriptionsToPetChemistYet":true,"PleaseSelectOneOfTheFollowingOptionsThatBestApplies":null,"DidYouPostYourPrescriptionByRegisteredTrackedOrExpressPostrecommended":false,"TrackingNumberForPostedOriginalPrescription":null,"PostalTrackingNumber":null,"PhotoOfTrackingNumber":[],"HaveYouPostedYourOriginalPrescriptionsToPetChemistYet2":"Yes","PleaseSelectOneOfTheFollowingOptionsThatBestApplies_IsRequired":false},"HaveYouOrderedOneOfTheFollowingRestrictedMedications":"No","OrderNumber_Minimum":18,"OrderNumber_IncrementBy":1},"Entry":{"AdminLink":"https://www.cognitoforms.com/MadPaws1/9/entries/114818","DateCreated":"2025-06-02T01:53:44.146Z","DateSubmitted":"2025-06-02T01:53:44.146Z","DateUpdated":"2025-06-02T01:53:44.146Z","Number":114818,"Order":null,"Origin":{"City":null,"CountryCode":null,"IpAddress":"122.150.145.21","IsImported":false,"Region":null,"Timezone":null,"UserAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"},"Timestamp":"2025-06-02T01:53:44.146Z","User":null,"Version":1,"Action":"Submit","Role":"Public","Status":"Submitted","Document1":"https://www.cognitoforms.com/d/Fxbx7xmyuEaChkNBzbdYNg?code=ez0KE34sQNZJdcPqoXP5EiDQN5Zc4jwBzzwExXUW1O4$","Document2":"https://www.cognitoforms.com/d/Fxbx7xmyuEaChkNBzbdYNg?code=lRl3X53BUmIzQ11V240cqDKFUL2KAsVhhBz11vmKV7s$"},"Id":"9-114818"},"headers":{"host":"api.retool.com","x-request-id":"803877dea68ab42ff8de878d1283f9bb","x-real-ip":"4.156.104.40","x-forwarded-for":"4.156.104.40","x-forwarded-host":"api.retool.com","x-forwarded-port":"443","x-forwarded-proto":"https","x-forwarded-scheme":"https","x-scheme":"https","content-length":"2145","x-requested-with":"XMLHttpRequest","user-agent":"CognitoForms","content-type":"application/json","request-id":"|dc270172-4a31-4885-b4f5-ce324f314868.22bde98a6da7c306.","traceparent":"00-1b2977c872e6d140259463cd1f6c5ed9-22bde98a6da7c306-00"},"urlParams":{},"pathParams":null}

Thanks for the payload and the IDs! I tracked down the workflow run and found an error saying "The workflow run exceeded the memory limit of around 1GB". Is it possible that your users are able to submit forms with too much data? Maybe you can look into your failed runs and see if there's a pattern with them in that regard, especially since you mentioned that it fails on reruns of that payload.

If you find anything I'd be curious to know but I'll keep looking into it on my end as well.

This is confusing.

This is a workflow that failed recently.
Starting run for workflow: dd91263c-4766-4167-a77d-5fde4d891328 in environment production
Mon 2025-06-02 15:32:36
Workflow Run Id: 01972f20-9ba1-7045-83ef-5c36759d0986
Mon 2025-06-02 15:32:36
Workflow Trigger Id: 5ce16f64-e9d4-4073-82ee-7a7ed08eb3c6

I assume it also exceeded the 1gb memory limit. There are 3 prescriptions attached to the form. If I run them individually they succeed, and state ~11mb data usage.
I've attached an image of what I see in the logs. Is it crashing on start up or further in the workflow? Do you see more diagnostic info than I've got here?
Assuming no, why would it exceed 1gb of memory on startTrigger, before my code has even started to run?

Script #1
Starting run for workflow: dd91263c-4766-4167-a77d-5fde4d891328 in environment production
Tue 2025-06-03 08:53:34
Workflow Run Id: 019732d9-a2f3-73ff-b04f-097bc3e407fa

Script #2
Starting run for workflow: dd91263c-4766-4167-a77d-5fde4d891328 in environment production
Tue 2025-06-03 08:54:12
Workflow Run Id: 019732da-3a74-767c-8e4c-fc790c72b681

Script #3
Starting run for workflow: dd91263c-4766-4167-a77d-5fde4d891328 in environment production
Tue 2025-06-03 08:54:34
Workflow Run Id: 019732da-904a-70cb-bee6-280860b8313f

For that workflow run, I'm seeing this error: "FATAL ERROR: Scavenger: semi-space copy Allocation failed - JavaScript heap out of memory", so it definitely tracks with memory issues. I also see the runtime error: exited workflow with code 139, and here is a thread on that. I've asked internally and there is a 100MB payload limit for any workflow block, so a lot lower than 1GB. While I get that ~33MB of data is lower than 100MB, I would still look into ways to limit the size of the incoming payloads.