weaviate.exceptions.UnexpectedStatusCodeException: Meta endpoint! Unexpected status code: 401, with response body #4786

Closed
opened 2026-02-21 18:08:01 -05:00 by yindo · 4 comments
Owner

Originally created by @muckthaa-ss on GitHub (Jul 25, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.15

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

[2024-07-25 09:40:20,394: INFO/MainProcess] Task tasks.document_indexing_task.document_indexing_task[2610a4be-cb9e-4134-89d9-f1ee0674b00b] received
[2024-07-25 09:40:20,394: INFO/MainProcess] Start process document: 95bdbcb0-b5e7-4c6a-951a-ee35b0571c27
[2024-07-25 09:41:35,300: ERROR/MainProcess] consume document failed
Traceback (most recent call last):
  File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\indexing_runner.py", line 76, in run
    self._load(
  File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\indexing_runner.py", line 689, in _load
    tokens += future.result()
  File "C:\Users\hrith\anaconda3\envs\dify_try\lib\concurrent\futures\_base.py", line 458, in result
    return self.__get_result()
  File "C:\Users\hrith\anaconda3\envs\dify_try\lib\concurrent\futures\_base.py", line 403, in __get_result
    raise self._exception
  File "C:\Users\hrith\anaconda3\envs\dify_try\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\indexing_runner.py", line 742, in _process_chunk
    index_processor.load(dataset, chunk_documents, with_keywords=False)
  File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\rag\index_processor\processor\paragraph_index_processor.py", line 59, in load
    vector = Vector(dataset)
  File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\rag\datasource\vdb\vector_factory.py", line 37, in __init__
    self._vector_processor = self._init_vector()
  File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\rag\datasource\vdb\vector_factory.py", line 48, in _init_vector
    return vector_factory_cls().init_vector(self._dataset, self._attributes, self._embeddings)
  File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\rag\datasource\vdb\weaviate\weaviate_vector.py", line 282, in init_vector
    return WeaviateVector(
  File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\rag\datasource\vdb\weaviate\weaviate_vector.py", line 36, in __init__
    self._client = self._init_client(config)
  File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\rag\datasource\vdb\weaviate\weaviate_vector.py", line 45, in _init_client
    client = weaviate.Client(
  File "C:\Users\hrith\anaconda3\envs\dify_try\lib\site-packages\weaviate\client.py", line 150, in __init__
    self._connection = Connection(
  File "C:\Users\hrith\anaconda3\envs\dify_try\lib\site-packages\weaviate\connect\connection.py", line 654, in __init__
    self._server_version = self.get_meta()["version"]
  File "C:\Users\hrith\anaconda3\envs\dify_try\lib\site-packages\weaviate\connect\connection.py", line 678, in get_meta
    raise UnexpectedStatusCodeException("Meta endpoint", response)
weaviate.exceptions.UnexpectedStatusCodeException: Meta endpoint! Unexpected status code: 401, with response body: {'code': 401, 'message': 'oidc auth is not configured, please try another auth scheme or set up weaviate with OIDC configured'}.
[2024-07-25 09:41:35,300: INFO/MainProcess] Processed dataset: ef2b0d8f-a569-4fee-a4e4-1ab709edb16e latency: 74.90517309999996
[2024-07-25 09:41:35,300: INFO/MainProcess] Task tasks.document_indexing_task.document_indexing_task[2610a4be-cb9e-4134-89d9-f1ee0674b00b] succeeded in 74.90600000000268s: None

image (1)

✔️ Expected Behavior

to create chunks list in knownlege

Actual Behavior

not working

Originally created by @muckthaa-ss on GitHub (Jul 25, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.6.15 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce ``` [2024-07-25 09:40:20,394: INFO/MainProcess] Task tasks.document_indexing_task.document_indexing_task[2610a4be-cb9e-4134-89d9-f1ee0674b00b] received [2024-07-25 09:40:20,394: INFO/MainProcess] Start process document: 95bdbcb0-b5e7-4c6a-951a-ee35b0571c27 [2024-07-25 09:41:35,300: ERROR/MainProcess] consume document failed Traceback (most recent call last): File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\indexing_runner.py", line 76, in run self._load( File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\indexing_runner.py", line 689, in _load tokens += future.result() File "C:\Users\hrith\anaconda3\envs\dify_try\lib\concurrent\futures\_base.py", line 458, in result return self.__get_result() File "C:\Users\hrith\anaconda3\envs\dify_try\lib\concurrent\futures\_base.py", line 403, in __get_result raise self._exception File "C:\Users\hrith\anaconda3\envs\dify_try\lib\concurrent\futures\thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\indexing_runner.py", line 742, in _process_chunk index_processor.load(dataset, chunk_documents, with_keywords=False) File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\rag\index_processor\processor\paragraph_index_processor.py", line 59, in load vector = Vector(dataset) File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\rag\datasource\vdb\vector_factory.py", line 37, in __init__ self._vector_processor = self._init_vector() File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\rag\datasource\vdb\vector_factory.py", line 48, in _init_vector return vector_factory_cls().init_vector(self._dataset, self._attributes, self._embeddings) File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\rag\datasource\vdb\weaviate\weaviate_vector.py", line 282, in init_vector return WeaviateVector( File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\rag\datasource\vdb\weaviate\weaviate_vector.py", line 36, in __init__ self._client = self._init_client(config) File "C:\Users\hrith\OneDrive\Documents\dify_try\dify\api\core\rag\datasource\vdb\weaviate\weaviate_vector.py", line 45, in _init_client client = weaviate.Client( File "C:\Users\hrith\anaconda3\envs\dify_try\lib\site-packages\weaviate\client.py", line 150, in __init__ self._connection = Connection( File "C:\Users\hrith\anaconda3\envs\dify_try\lib\site-packages\weaviate\connect\connection.py", line 654, in __init__ self._server_version = self.get_meta()["version"] File "C:\Users\hrith\anaconda3\envs\dify_try\lib\site-packages\weaviate\connect\connection.py", line 678, in get_meta raise UnexpectedStatusCodeException("Meta endpoint", response) weaviate.exceptions.UnexpectedStatusCodeException: Meta endpoint! Unexpected status code: 401, with response body: {'code': 401, 'message': 'oidc auth is not configured, please try another auth scheme or set up weaviate with OIDC configured'}. [2024-07-25 09:41:35,300: INFO/MainProcess] Processed dataset: ef2b0d8f-a569-4fee-a4e4-1ab709edb16e latency: 74.90517309999996 [2024-07-25 09:41:35,300: INFO/MainProcess] Task tasks.document_indexing_task.document_indexing_task[2610a4be-cb9e-4134-89d9-f1ee0674b00b] succeeded in 74.90600000000268s: None ``` ![image (1)](https://github.com/user-attachments/assets/007594a6-1535-4635-95a9-c6dd5b653fd3) ### ✔️ Expected Behavior to create chunks list in knownlege ### ❌ Actual Behavior not working
yindo added the 🤔 cant-reproduce label 2026-02-21 18:08:01 -05:00
yindo closed this issue 2026-02-21 18:08:01 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 25, 2024):

@muckthaa-ss Hello! I'm here to help you with your issue. If you need assistance with bug reports, questions, or becoming a contributor, I'm at your service while you wait for a human maintainer.

The error weaviate.exceptions.UnexpectedStatusCodeException: Meta endpoint! Unexpected status code: 401, with response body: {'code': 401, 'message': 'oidc auth is not configured, please try another auth scheme or set up weaviate with OIDC configured'} indicates that the Weaviate service is expecting OIDC (OpenID Connect) authentication, but it is not configured.

To resolve this issue, you can either configure OIDC authentication for Weaviate or switch to another authentication scheme, such as API key-based authentication. Here are the steps to configure API key-based authentication:

  1. Ensure API Key Authentication is Enabled:
    In your docker-compose.yaml file, make sure the following environment variables are set for the Weaviate service:

    weaviate:
      image: semitechnologies/weaviate:1.19.0
      restart: always
      volumes:
        - ./volumes/weaviate:/var/lib/weaviate
      environment:
        PERSISTENCE_DATA_PATH: ${PERSISTENCE_DATA_PATH:-'/var/lib/weaviate'}
        QUERY_DEFAULTS_LIMIT: ${QUERY_DEFAULTS_LIMIT:-25}
        AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: ${AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED:-false}
        DEFAULT_VECTORIZER_MODULE: ${DEFAULT_VECTORIZER_MODULE:-none}
        CLUSTER_HOSTNAME: ${CLUSTER_HOSTNAME:-node1}
        AUTHENTICATION_APIKEY_ENABLED: ${AUTHENTICATION_APIKEY_ENABLED:-true}
        AUTHENTICATION_APIKEY_ALLOWED_KEYS: ${AUTHENTICATION_APIKEY_ALLOWED_KEYS:-WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih}
        AUTHENTICATION_APIKEY_USERS: ${AUTHENTICATION_APIKEY_USERS:-hello@dify.ai}
        AUTHORIZATION_ADMINLIST_ENABLED: ${AUTHORIZATION_ADMINLIST_ENABLED:-true}
        AUTHORIZATION_ADMINLIST_USERS: ${AUTHORIZATION_ADMINLIST_USERS:-hello@dify.ai}
      ports:
        - "8080:8080"
    
  2. Set the Weaviate API Key and Endpoint:
    Ensure that the WEAVIATE_API_KEY and WEAVIATE_ENDPOINT environment variables are correctly set in your environment. You can add these to your .env file or directly in the docker-compose.yaml file:

    environment:
      WEAVIATE_ENDPOINT: http://weaviate:8080
      WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
    
  3. Update the Weaviate Client Configuration:
    Ensure that your Weaviate client in the code is configured to use the API key. This typically involves setting the API key in the client initialization:

    import weaviate
    
    client = weaviate.Client(
        url="http://weaviate:8080",
        auth_client_secret=weaviate.AuthApiKey(api_key="WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih")
    )
    

By following these steps, you should be able to resolve the authentication issue and ensure that the document indexing task completes successfully [1][2][3].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jul 25, 2024): <!-- Greeting --> @muckthaa-ss Hello! I'm here to help you with your issue. If you need assistance with bug reports, questions, or becoming a contributor, I'm at your service while you wait for a human maintainer. <!-- Answer --> The error `weaviate.exceptions.UnexpectedStatusCodeException: Meta endpoint! Unexpected status code: 401, with response body: {'code': 401, 'message': 'oidc auth is not configured, please try another auth scheme or set up weaviate with OIDC configured'}` indicates that the Weaviate service is expecting OIDC (OpenID Connect) authentication, but it is not configured. To resolve this issue, you can either configure OIDC authentication for Weaviate or switch to another authentication scheme, such as API key-based authentication. Here are the steps to configure API key-based authentication: 1. **Ensure API Key Authentication is Enabled**: In your `docker-compose.yaml` file, make sure the following environment variables are set for the Weaviate service: ```yaml weaviate: image: semitechnologies/weaviate:1.19.0 restart: always volumes: - ./volumes/weaviate:/var/lib/weaviate environment: PERSISTENCE_DATA_PATH: ${PERSISTENCE_DATA_PATH:-'/var/lib/weaviate'} QUERY_DEFAULTS_LIMIT: ${QUERY_DEFAULTS_LIMIT:-25} AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: ${AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED:-false} DEFAULT_VECTORIZER_MODULE: ${DEFAULT_VECTORIZER_MODULE:-none} CLUSTER_HOSTNAME: ${CLUSTER_HOSTNAME:-node1} AUTHENTICATION_APIKEY_ENABLED: ${AUTHENTICATION_APIKEY_ENABLED:-true} AUTHENTICATION_APIKEY_ALLOWED_KEYS: ${AUTHENTICATION_APIKEY_ALLOWED_KEYS:-WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih} AUTHENTICATION_APIKEY_USERS: ${AUTHENTICATION_APIKEY_USERS:-hello@dify.ai} AUTHORIZATION_ADMINLIST_ENABLED: ${AUTHORIZATION_ADMINLIST_ENABLED:-true} AUTHORIZATION_ADMINLIST_USERS: ${AUTHORIZATION_ADMINLIST_USERS:-hello@dify.ai} ports: - "8080:8080" ``` 2. **Set the Weaviate API Key and Endpoint**: Ensure that the `WEAVIATE_API_KEY` and `WEAVIATE_ENDPOINT` environment variables are correctly set in your environment. You can add these to your `.env` file or directly in the `docker-compose.yaml` file: ```yaml environment: WEAVIATE_ENDPOINT: http://weaviate:8080 WEAVIATE_API_KEY: WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih ``` 3. **Update the Weaviate Client Configuration**: Ensure that your Weaviate client in the code is configured to use the API key. This typically involves setting the API key in the client initialization: ```python import weaviate client = weaviate.Client( url="http://weaviate:8080", auth_client_secret=weaviate.AuthApiKey(api_key="WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih") ) ``` By following these steps, you should be able to resolve the authentication issue and ensure that the document indexing task completes successfully <sup>[[1]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/api/configs/middleware/vdb/weaviate_config.py)</sup><sup>[[3]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.middleware.yaml)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@muckthaa-ss commented on GitHub (Jul 26, 2024):

@dosu I have deployed dify locally from source code and never used docker at all. So How can I proceed? Also I have setup PostgreSQL, Redis and Weaviate locally.

@muckthaa-ss commented on GitHub (Jul 26, 2024): @dosu I have deployed dify locally from source code and never used docker at all. So How can I proceed? Also I have setup PostgreSQL, Redis and Weaviate locally.
Author
Owner

@dosubot[bot] commented on GitHub (Jul 26, 2024):

To proceed with configuring Weaviate for a local deployment without using Docker, you need to ensure that the necessary environment variables and configurations are set correctly. Here are the steps to configure API key-based authentication for Weaviate:

  1. Set Environment Variables:
    Ensure that the following environment variables are set in your system. You can add these to your .env file in the api directory:

    WEAVIATE_ENDPOINT=http://localhost:8080
    WEAVIATE_API_KEY=your-api-key
    
  2. Configure Weaviate in Your Code:
    Update your Weaviate client initialization in the code to use the API key for authentication. Here is an example of how to do this in Python:

    import weaviate
    
    client = weaviate.Client(
        url="http://localhost:8080",
        auth_client_secret=weaviate.AuthApiKey(api_key="your-api-key")
    )
    
  3. Ensure Weaviate Configuration:
    Make sure that Weaviate is configured to accept API key authentication. You can set these configurations in the Weaviate configuration file or as environment variables when starting the Weaviate service. Here are the relevant settings:

    AUTHENTICATION_APIKEY_ENABLED=true
    AUTHENTICATION_APIKEY_ALLOWED_KEYS=your-api-key
    AUTHENTICATION_APIKEY_USERS=your-email@example.com
    AUTHORIZATION_ADMINLIST_ENABLED=true
    AUTHORIZATION_ADMINLIST_USERS=your-email@example.com
    
  4. Update .env File:
    If you haven't already, create a .env file in the api directory and add the necessary configurations:

    WEAVIATE_ENDPOINT=http://localhost:8080
    WEAVIATE_API_KEY=your-api-key
    AUTHENTICATION_APIKEY_ENABLED=true
    AUTHENTICATION_APIKEY_ALLOWED_KEYS=your-api-key
    AUTHENTICATION_APIKEY_USERS=your-email@example.com
    AUTHORIZATION_ADMINLIST_ENABLED=true
    AUTHORIZATION_ADMINLIST_USERS=your-email@example.com
    
  5. Restart Services:
    After setting the environment variables and updating the configurations, restart your Weaviate service to apply the changes.

By following these steps, you should be able to configure Weaviate to use API key-based authentication and resolve the 401 error related to OIDC authentication not being configured [1][2].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Jul 26, 2024): <!-- Answer --> To proceed with configuring Weaviate for a local deployment without using Docker, you need to ensure that the necessary environment variables and configurations are set correctly. Here are the steps to configure API key-based authentication for Weaviate: 1. **Set Environment Variables:** Ensure that the following environment variables are set in your system. You can add these to your `.env` file in the `api` directory: ```plaintext WEAVIATE_ENDPOINT=http://localhost:8080 WEAVIATE_API_KEY=your-api-key ``` 2. **Configure Weaviate in Your Code:** Update your Weaviate client initialization in the code to use the API key for authentication. Here is an example of how to do this in Python: ```python import weaviate client = weaviate.Client( url="http://localhost:8080", auth_client_secret=weaviate.AuthApiKey(api_key="your-api-key") ) ``` 3. **Ensure Weaviate Configuration:** Make sure that Weaviate is configured to accept API key authentication. You can set these configurations in the Weaviate configuration file or as environment variables when starting the Weaviate service. Here are the relevant settings: ```plaintext AUTHENTICATION_APIKEY_ENABLED=true AUTHENTICATION_APIKEY_ALLOWED_KEYS=your-api-key AUTHENTICATION_APIKEY_USERS=your-email@example.com AUTHORIZATION_ADMINLIST_ENABLED=true AUTHORIZATION_ADMINLIST_USERS=your-email@example.com ``` 4. **Update `.env` File:** If you haven't already, create a `.env` file in the `api` directory and add the necessary configurations: ```plaintext WEAVIATE_ENDPOINT=http://localhost:8080 WEAVIATE_API_KEY=your-api-key AUTHENTICATION_APIKEY_ENABLED=true AUTHENTICATION_APIKEY_ALLOWED_KEYS=your-api-key AUTHENTICATION_APIKEY_USERS=your-email@example.com AUTHORIZATION_ADMINLIST_ENABLED=true AUTHORIZATION_ADMINLIST_USERS=your-email@example.com ``` 5. **Restart Services:** After setting the environment variables and updating the configurations, restart your Weaviate service to apply the changes. By following these steps, you should be able to configure Weaviate to use API key-based authentication and resolve the `401` error related to OIDC authentication not being configured <sup>[[1]](https://github.com/langgenius/dify/blob/main/api/configs/middleware/vdb/weaviate_config.py)</sup><sup>[[2]](https://github.com/langgenius/dify/blob/main/docker/docker-compose.yaml)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Jul 29, 2024):

@dosu I have deployed dify locally from source code and never used docker at all. So How can I proceed? Also I have setup PostgreSQL, Redis and Weaviate locally.

If you don't run docker at all.

# ------------------------------
# Environment Variables for weaviate Service
# ------------------------------
WEAVIATE_QUERY_DEFAULTS_LIMIT=25
WEAVIATE_AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true
WEAVIATE_DEFAULT_VECTORIZER_MODULE=none
WEAVIATE_CLUSTER_HOSTNAME=node1
WEAVIATE_AUTHENTICATION_APIKEY_ENABLED=true
WEAVIATE_AUTHENTICATION_APIKEY_ALLOWED_KEYS=WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih
WEAVIATE_AUTHENTICATION_APIKEY_USERS=hello@dify.ai
WEAVIATE_AUTHORIZATION_ADMINLIST_ENABLED=true
WEAVIATE_AUTHORIZATION_ADMINLIST_USERS=hello@dify.ai

These variables are important to the setup as the bot suggests.

@crazywoola commented on GitHub (Jul 29, 2024): > @dosu I have deployed dify locally from source code and never used docker at all. So How can I proceed? Also I have setup PostgreSQL, Redis and Weaviate locally. If you don't run docker at all. ``` # ------------------------------ # Environment Variables for weaviate Service # ------------------------------ WEAVIATE_QUERY_DEFAULTS_LIMIT=25 WEAVIATE_AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true WEAVIATE_DEFAULT_VECTORIZER_MODULE=none WEAVIATE_CLUSTER_HOSTNAME=node1 WEAVIATE_AUTHENTICATION_APIKEY_ENABLED=true WEAVIATE_AUTHENTICATION_APIKEY_ALLOWED_KEYS=WVF5YThaHlkYwhGUSmCRgsX3tD5ngdN8pkih WEAVIATE_AUTHENTICATION_APIKEY_USERS=hello@dify.ai WEAVIATE_AUTHORIZATION_ADMINLIST_ENABLED=true WEAVIATE_AUTHORIZATION_ADMINLIST_USERS=hello@dify.ai ``` These variables are important to the setup as the bot suggests.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#4786