# Weird Error When Running index.query

**URL:** <https://community.pinecone.io/t/weird-error-when-running-index-query/3699>\
**Category:** Support\
**Created:** [November 18, 2023, 11:24am UTC](https://community.pinecone.io/t/weird-error-when-running-index-query/3699 "2023-11-18T11:24:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhlfrfufyfn](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/jhlfrfufyfn/32/1674_2.png) [@jhlfrfufyfn](https://community.pinecone.io/u/jhlfrfufyfn)\
**Post date:** [November 18, 2023, 11:24am UTC](https://community.pinecone.io/t/weird-error-when-running-index-query/3699/1 "2023-11-18T11:24:51Z")

</div>

Hello, i am trying to query my ‘gcp-starter’ index like this:

```auto

output = index.query(
            # id=None,
            # vector=None,
            filter={"public_identifier": {"$in": public_identifiers}},
            include_metadata=True,
            top_k=len(public_identifiers) * 3,
        )

```

It throws 400 ‘Bad Request’ with {“code”:3,“message”:“Cannot provide both ‘ID’ and ‘vector’ at the same time”,“details”:}

I am not using id or vector, what could be the problem?

---

<div class="post-metadata">

**Author:** ![zeke](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/zeke/32/4257_2.png) [@zeke](https://community.pinecone.io/u/zeke)\
**Post date:** [November 18, 2023, 6:05pm UTC](https://community.pinecone.io/t/weird-error-when-running-index-query/3699/2 "2023-11-18T18:05:48Z")

</div>

@jhlfrfufyfn I’m unable to reproduce the same error message when I execute a similar operation on one of my indexes. When I don’t provide an ID or a vector, I get: `{"code":3,"message":"No query provided","details":[]}`.

Could you please check and share what version of the Python SDK you are using? The most recent version is `v2.2.4`.

Also, please note that the `query()` request must contain one (and only one) of the `id` or `vector` parameters, so the code you’ve provided is expected to result in an error.

---

<div class="post-metadata">

**Author:** ![tim](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/tim/32/1503_2.png) [@tim](https://community.pinecone.io/u/tim)\
**Post date:** [November 18, 2023, 10:00pm UTC](https://community.pinecone.io/t/weird-error-when-running-index-query/3699/3 "2023-11-18T22:00:40Z")

</div>

It looks like you are attempting to run a query on `metadata` alone. The `query` method requires **only** an `id` or `vector` and `None` is not a valid value for either. And at least one of those two `kwargs` is required.

To do what you want to accomplish you should pass in a `n`-dimension list of all `0`’s.

So for example, lets say you are searching across an index that is configured for OpenAI’s `text-embedding-ada-002 (1536 dimensions)

```python
output = index.query(
            vector=[0] * 1536, # [0,0,0,0......0]
            filter={"public_identifier": {"$in": public_identifiers}},
            include_metadata=True,
            top_k=len(public_identifiers) * 3,
        )
# Output will give you top `len(public_identifiers) * 3` it can return!

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/pinecone/original/1X/d16664eba369eeee623700cf12feab5562b37eaf.jpeg) [@system](https://community.pinecone.io/u/system)\
**Post date:** [November 20, 2023, 5:10pm UTC](https://community.pinecone.io/t/weird-error-when-running-index-query/3699/4 "2023-11-20T17:10:51Z")

</div>

Closed on November 20, 2023, 5:10pm UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
