Job can’t be canceled, why?


We have an Error to the cancel job.
Can you help us, please?

I have created a job:

<201 Created,
{Date=[Mon, 03 Sep 2018 15:38:58 GMT],
Content-Type=[application/json], Content-Length=[1803], Connection=[keep-alive],
Status=[201 Created],
Cache-Control=[max-age=0, private, must-revalidate], Vary=[Origin], X-DailyRateLimit-Limit=[43200],
X-DailyRateLimit-Remaining=[35090], X-Request-Id=[9734a0b2-692f-4141-98d8-c0b40a230739], X-MinuteRateLimit-Limit=[500], X-MinuteRateLimit-Remaining=[422],
ETag=[W/“5295ae3164a9b52b1524fa5b8d497efb”], X-Runtime=[2.163862], Server=[nginx + Phusion Passenger]}

“comment”:“Preguntar por Rodolf”,
“street”:“Calle del Camino de los Vinateros s/n”,
“formatted_address”:“Calle del Camino de los Vinateros s/n, 28017, Madrid, Spain”
“company_name”:“Rodol Moratalaz”,

        "comment":"piso 2, puerta izq.",
           "street":"Calle del Corregidor Diego de Valderrabano 25",
           "formatted_address":"Calle del Corregidor Diego de Valderrabano 25, 28030, Madrid, Spain"



i exceute cancelJob service

and result is …

{“error”:“CANCELLATION_ERROR”,“message”:“Job can’t be canceled”}

Hi @carlosMshop,

This error means that you cannot cancel the job. Please have a look at the following topic How does cancellation works? to understand the cancellation mechanism.

Notice that you are not allowed to cancel with the cancel a Job endpoint after the driver picked the package. In the sandbox environment the pickup usually happens really fast.


I want cancel this Job 109270
Now this Job is in staus In Progress
why does it return this error ?

POST request for “cancel” resulted in 422 (Unprocessable Entity); invoking error handler

errorResponse CancelStuart: {“error”:“CANCELLATION_ERROR”,“message”:“Job can’t be canceled”}


If the driver already picked up the package then you are not allowed to cancel the job (see my answer just above).I confirm you that this is the expected behaviour. In production you will need to contact the Stuart Support Team in that case.

OK. In test , How can we do to simulate a cancellation?


You’re welcome,
to simulate a cancellation you can try to do it very quickly (before pickup) or you can easily schedule a job for later on so you have time to cancel it.

We can also plan a call to do end-to-end tests and simulate this case together if needed.


We are doing the test, quickly.

First, create a job. and immediately afterwards we generated the cancellation.
But, the result is the same.

We want to go through several states and cancel it them

is it posible?


Best way to do that will be to synchronise so we can simulate this together. Let me pm you to find the best time for that.