Sometimes User task completion Getting Failed from Java Api

This issue happened rarely, When this issue happened Java call reaching up to process engine.getTaskService().complete.(task.getId()). After execution of this line no record/incident or completion of task in cockpit.
Then I checked my logs.
I found one exception:-
org.camunda.bpm.engine.ProcessEngineException: ENGINE-03051 There was an exception while invoking the TaskListener. Message: "Unable to evaluate script while executing activity {taskId} in the process definition with id {processInstanceId}:ReferenceError: “execution” is not defined in ceval> at line number.

Hello my dear!

So I can better understand the context… and try to help you as best I can.

  • Does this error happen rarely or every time you run this script? Did your script ever run correctly?

  • Did you make sure that when your script called the “processInstanceId”, it still existed in the process? (for example, if no one “completed” the task manually?).

  • Was the task “claim” made before completing it?

  • This script of yours was made where? in a task listner inside camunda modeler, or in springboot java code or as an external task?

William Robert Alves

Thank you for Response,

This issue is resolved, This issue was happening due to some wrong user input. Apologies for taking up your time.

Hi @rohit_parjane,

Apparently you call complete method from within the task listener.
May we know your use case?
On what event (create, assignment, complete…) the task listener is configured to trigger?
Are there any statements that following the complete statement?

1 Like

I suggest using a safe way to interrupt the task.

For example: you can attach an interrupting conditional event to the user task.

I will share a running example tonight.


Hi @hassang

We are Completing user task using process engine from Java Code.
Recently I don’t have used case.
But we found one observation someone is taking action on task from cockpit and after that our java code trying to complete (not sure this causes issue). Now we added some conditions in java code so this issue is not getting in this days.