# Cannot query GraphQL API for tasks by processInstanceId in versions prior to 8.1.7

**URL:** <https://forum.camunda.io/t/cannot-query-graphql-api-for-tasks-by-processinstanceid-in-versions-prior-to-8-1-7/45363>\
**Category:** Discussion & Questions\
**Tags:** camunda-8-slack\
**Created:** [May 30, 2023, 9:54am UTC](https://forum.camunda.io/t/cannot-query-graphql-api-for-tasks-by-processinstanceid-in-versions-prior-to-8-1-7/45363 "2023-05-30T09:54:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![slack-archivist](https://forum.camunda.io/user_avatar/forum.camunda.io/slack-archivist/32/19668_2.png) [@slack-archivist](https://forum.camunda.io/u/slack-archivist)\
**Post date:** [May 30, 2023, 9:54am UTC](https://forum.camunda.io/t/cannot-query-graphql-api-for-tasks-by-processinstanceid-in-versions-prior-to-8-1-7/45363/1 "2023-05-30T09:54:04Z")

</div>

**Vlad Bulimac** : hi all. I’m running camunda self managed v8.1.6 and trying to get a list of active tasks by processInstanceId using tasklist graphql api and i get the following error

```auto
[GraphQLError(message=Validation error of type WrongType: argument 'query' with value 'ObjectValue{objectFields=[ObjectField{name='state', value=EnumValue{name='CREATED'}}, ObjectField{name='processInstanceId', value=StringValue{value='2251799816869227'}}]}' contains a field not in 'TaskQuery': 'processInstanceId' @ 'tasks', path=[], locations=[{line=2, column=9}], extensions=GraphQLErrorExtensions(errorType=null, errorDetail=null, origin=, debugInfo=GraphQLErrorDebugInfo(subquery=, variables={}), classification=ValidationError))]

```

the query i’m trying

```auto
query {\n tasks(query: {state : CREATED, processInstanceId : \"2251799816869227\"}) {\n id\n name\n processName\n assignee\n candidateGroups\n formKey\n taskState\n variables {\n name\n value\n isValueTruncated\n }\n }\n}

```

as far as i can see in the documentation for v8.1 [https://docs.camunda.io/docs/8.1/apis-tools/tasklist-api/inputs/task-query/|here](https://docs.camunda.io/docs/8.1/apis-tools/tasklist-api/inputs/task-query/%7Chere) this should be a valid query. am i missing something? has anyone faced this issue before?

**Josh Wulf** : Yeah, that doesn’t work.

**Josh Wulf** : In implementing the Node.js API client, I discovered that this doesn’t work.

I can’t remember where it got documented.

You basically have to pull all the created tasks and filter by process instance Id

**Vlad Bulimac** : Wondering if it works in camunda 8.2. Retrieving all active tasks and filter them might be a costly operation for me. Also any idea if specifying the processInstanceId of the parent process will find the tasks from child processes - e.g. call activities started by the parent process?

**Marcos Vieira** : hi \<@U03TENKERCK\>, the processInstanceId filter was fixed on version 8.1.7 or any version above… I did the test also with 8.2 version and filtering by processInstanceId worked fine…

\<@UT1BZ1GAG\> did you get this error in recent versions or in the past, just checking if we need to review this again

**Josh Wulf** : It was in the past. Good to know that it was fixed, and the fix version.

**Note** : _This post was generated by [Slack Archivist](https://github.com/Camunda-DevRel/slack-archivist) from a conversation in the Camunda Platform 8 Slack, a source of valuable discussions on Camunda 8 ([join here](http://www.camunda.com/slack)). Someone in the Slack thought this was worth sharing!_

_If this post answered a question for you, hit the Like button - we use that to assess which posts to put into docs._

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [January 31, 2024, 10:52am UTC](https://forum.camunda.io/t/cannot-query-graphql-api-for-tasks-by-processinstanceid-in-versions-prior-to-8-1-7/45363/2 "2024-01-31T10:52:43Z")

</div>

Closed on January 31, 2024, 10:52am UTC


