How to get tasks of given processs instance using camundataskclientapi in java in camunda 8

I am using below link to use camunda taskclient api in java code.

I am using SimpleAuthentication.My camundataskcleint object is also get initialised and created.
I am using just piece of code to get tasks from given process isntances.
SimpleAuthentication sa = new SimpleAuthentication(“demo”, “demo”);

//shouldReturnVariables will change the default behaviour for the client to query variables along with tasks.
CamundaTaskListClient client = new CamundaTaskListClient.Builder().taskListUrl(“http://localhost:8081”).shouldReturnVariables().authentication(sa).build();
//get tasks from a process instance (TaskSearch can take many more parameters)
TaskSearch ts = new TaskSearch().setProcessInstanceId(“2251799818839086”);
TaskList tasksFromInstance = client.getTasks(ts);

//get tasks assigned to demo
TaskList tasks = client.getAssigneeTasks(“demo”, TaskState.CREATED, null);
for(Task task : tasks) {
client.unclaim(task.getId());
}

But it shows below error :

Exception in thread “main” io.camunda.tasklist.exception.TaskListException: Error(message = Validation error of type WrongType:
argument ‘query’ with value ‘ObjectValue{objectFields=[ObjectField{name=‘candidateGroup’,
value=VariableReference{name=‘candidateGroup’}},
ObjectField{name=‘assignee’, value=VariableReference{name=‘assignee’}},
ObjectField{name=‘assigned’, value=VariableReference{name=‘assigned’}},
ObjectField{name=‘state’, value=VariableReference{name=‘state’}},
ObjectField{name=‘processDefinitionId’, value=VariableReference{name=‘processDefinitionId’}},
ObjectField{name=‘processInstanceId’, value=VariableReference{name=‘processInstanceId’}},
ObjectField{name=‘taskDefinitionId’, value=VariableReference{name=‘taskDefinitionId’}},
ObjectField{name=‘pageSize’, value=VariableReference{name=‘pageSize’}},
ObjectField{name=‘searchAfter’, value=VariableReference{name=‘searchAfter’}},
ObjectField{name=‘searchBefore’, value=VariableReference{name=‘searchBefore’}},
ObjectField{name=‘searchAfterOrEqual’, value=VariableReference{name=‘searchAfterOrEqual’}}]}’ c
ontains a field not in ‘TaskQuery’: ‘processDefinitionId’ @ ‘tasks’, locations = [Location(line = 1, column = 303)],
path=null, extensions = {classification=ValidationError}, nonStandardFields = null)
at io.camunda.tasklist.CamundaTaskListClient.execute(CamundaTaskListClient.java:253)
at io.camunda.tasklist.CamundaTaskListClient.getTasks(CamundaTaskListClient.java:225)
at io.camunda.tasklist.CamundaTaskListClient.getTasks(CamundaTaskListClient.java:181)
at io.camunda.tasklist.CamundaTaskListClient.getAssigneeTasks(CamundaTaskListClient.java:98)
at io.camunda.tasklist.CamundaTaskListClient.getAssigneeTasks(CamundaTaskListClient.java:86)
at com.taskclient.camundataskclient.GetUserData.getUserData(GetUserData.java:33)
at com.taskclient.camundataskclient.CamundataskclientApplication.main(CamundataskclientApplication.java:16)

How to resolve this error? We want to retrieve tasks of process instance in camunda 8
I am using camunda 8.1

Hi, and welcome to the Camunda Forum!

Try taking the ProcessDefinitionID out of your query, since the error seems to be saying that that column doesn’t exist.

Thanks for response.But i have not passed processDefinitionID anywhere