401 Unauthorized Error / HTTP Response

Hi,
I’m encountering a 401 Unauthorized error while trying to retrieve data from an API. The error indicates an ‘Unauthorized’ status, even though I’ve checked my API key and confirmed it should have the right permissions.

{
    "detail": "(401)\nReason: Unauthorized\nHTTP response headers: HTTPHeaderDict({'x-pinecone-auth-rejected-reason': 'Unauthorized', 'www-authenticate': 'Unauthorized', 'Content-Length': '12', 'content-type': 'text/plain', 'date': 'Wed, 24 Apr 2024 19:27:26 GMT', 'server': 'envoy', 'Via': '1.1 google', 'Alt-Svc': 'h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000'})\nHTTP response body: Unauthorized\n\nStack Trace:\nTraceback (most recent call last):\n  File \"app/main.py\", line 395, in get_one_answer\n    llm_output = get_llm_model_answer(query, config_llm, vectorstore, index)\n  File \"app/main.py\", line 256, in get_llm_model_answer\n    contexts, datatables = retrieve_from_database(\n  File \"app/main.py\", line 154, in retrieve_from_database\n    stats = index.describe_index_stats()\n  File \"<library_path>/site-packages/pinecone/utils/error_handling.py\", line 10, in inner_func\n    return func(*args, **kwargs)\n  File \"<library_path>/site-packages/pinecone/data/index.py\", line 494, in describe_index_stats\n    return self._vector_api.describe_index_stats(\n  File \"<library_path>/site-packages/pinecone/core/client/api_client.py\", line 772, in __call__\n    return this.callable(this, *args, **kwargs)\n  File \"<library_path>/site-packages/pinecone/core/client/api/data_plane_api.py\", line 467, in __describe_index_stats\n    return this.call_with_http_info(**kwargs)\n  File \"<library_path>/site-packages/pinecone/core/client/api_client.py\", line 834, in call_with_http_info\n    return this.api_client.call_api(\n  File \"<library_path>/site-packages/pinecone/core/client/api_client.py\", line 409, in call_api\n    return this.__call_api(resource_path, method,\n  File \"<library_path>/site-packages/pinecone/core/client/api_client.py\", line 203, in __call_api\n    raise e\n  File \"<library_path>/site-packages/pinecone/core/client/api_client.py\", line 196, in __call_api\n    response_data = this.request(\n  File \"<library_path>/site-packages/pinecone/core/client/rest.py\", line 302, in POST\n    return this.request(\"POST\", url,\n  File \"<library_path>/site-packages/pinecone/core/client/rest.py\", line 250, in request\n    raise UnauthorizedException(http_resp=r)\npinecone.core.client.exceptions.UnauthorizedException: (401)\nReason: Unauthorized\nHTTP response headers: HTTPHeaderDict({'x-pinecone-auth-rejected-reason': 'Unauthorized', 'www-authenticate': 'Unauthorized', 'Content-Length': '12', 'content-type': 'text/plain', 'date': 'Wed, 24 Apr 2024 19:27:26 GMT', 'server': 'envoy', 'Via': '1.1 google', 'Alt-Svc': 'h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000'})\nHTTP response body: Unauthorized\n\n"
}

I’ve already confirmed my API key is correct and should have the right access level. Is there something else that might cause this error? How should I go about further troubleshooting this issue?

Thanks for any help you can provide!

Hello @ben.ferenc.burian,

  • Are you still seeing this issue?
  • Can you access the web console for this index?