PraisonAI icon indicating copy to clipboard operation
PraisonAI copied to clipboard

DATABASE ERROR?

Open RFARREY opened this issue 1 year ago • 0 comments

what's the error?

    └── win32_window.h 2024-07-17 16:25:44,348 - 9536 - sql_alchemy.py-sql_alchemy:92 - WARNING: An error occurred: (sqlite3.OperationalError) database is locked [SQL:       INSERT INTO steps ("id", "threadId", "createdAt", "start", "end", "output", "name", "type", "streaming", "disableFeedback", "isError", "waitForAnswer", "metadata", "generation")        VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)       ON CONFLICT (id) DO UPDATE       SET "threadId" = ?, "createdAt" = ?, "start" = ?, "end" = ?, "output" = ?, "name" = ?, "type" = ?, "streaming" = ?, "disableFeedback" = ?, "isError" = ?, "waitForAnswer" = ?, "metadata" = ?, "generation" = ?;     ] [parameters: ('09f7ea71-2a09-485d-b055-d32207472915', '2b7ed568-ce10-419c-bc78-5aee978362dc', '2024-07-17T14:23:53.075692Z', '2024-07-17T14:23:53.075692Z', '2024-07-17T14:23:53.075692Z', 'What are my project requirements?', 'admin', 'user_message', False, False, False, False, '{}', '{}', '2b7ed568-ce10-419c-bc78-5aee978362dc', '2024-07-17T14:23:53.075692Z', '2024-07-17T14:23:53.075692Z', '2024-07-17T14:23:53.075692Z', 'What are my project requirements?', 'admin', 'user_message', False, False, False, False, '{}', '{}')] (Background on this error at: https://sqlalche.me/e/20/e3q8) 2024-07-17 16:25:46,248 - 9536 - utils.py-utils:50 - ERROR: litellm.BadRequestError: GetLLMProvider Exception - list index out of range

original model: gemini Traceback (most recent call last):  File "D:\MY FLUTTER DEV PROJECTS\shopping_list_app\HERB_APP\HERB_GROWING_COMMUNITY_SHARING\herb_community_sharing_scheme\budgrowX\Lib\site-packages\litellm\utils.py", line 4353, in get_llm_provider   model = model.split("/", 1)[1]       ~~~~~~~~~~~~~~~~~~~^^^ IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):  File "D:\MY FLUTTER DEV PROJECTS\shopping_list_app\HERB_APP\HERB_GROWING_COMMUNITY_SHARING\herb_community_sharing_scheme\budgrowX\Lib\site-packages\chainlit\utils.py", line 44, in wrapper    return await user_function(**params_values)       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "D:\MY FLUTTER DEV PROJECTS\shopping_list_app\HERB_APP\HERB_GROWING_COMMUNITY_SHARING\herb_community_sharing_scheme\budgrowX\Lib\site-packages\praisonai\ui\code.py", line 245, in main   response = await acompletion(         ^^^^^^^^^^^^^^^^^^  File "D:\MY FLUTTER DEV PROJECTS\shopping_list_app\HERB_APP\HERB_GROWING_COMMUNITY_SHARING\herb_community_sharing_scheme\budgrowX\Lib\site-packages\litellm\utils.py", line 1505, in wrapper_async   raise e  File "D:\MY FLUTTER DEV PROJECTS\shopping_list_app\HERB_APP\HERB_GROWING_COMMUNITY_SHARING\herb_community_sharing_scheme\budgrowX\Lib\site-packages\litellm\utils.py", line 1317, in wrapper_async   result = await original_function(*args, **kwargs)        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "D:\MY FLUTTER DEV PROJECTS\shopping_list_app\HERB_APP\HERB_GROWING_COMMUNITY_SHARING\herb_community_sharing_scheme\budgrowX\Lib\site-packages\litellm\main.py", line 338, in acompletion   _, custom_llm_provider, _, _ = get_llm_provider(                   ^^^^^^^^^^^^^^^^^  File "D:\MY FLUTTER DEV PROJECTS\shopping_list_app\HERB_APP\HERB_GROWING_COMMUNITY_SHARING\herb_community_sharing_scheme\budgrowX\Lib\site-packages\litellm\utils.py", line 4531, in get_llm_provider   raise litellm.exceptions.BadRequestError( # type: ignore litellm.exceptions.BadRequestError: litellm.BadRequestError: GetLLMProvider Exception - list index out of range

original model: gemini

LLM SUGGESTIONS FOR THE FIX :

There are actually two errors present in the logs you provided:

  1. Database Error (WARNING):

Error Message: (sqlite3.OperationalError) database is locked Explanation: This is a warning message indicating that the database you're trying to insert data into is currently locked. This means another process might be using the database and preventing your code from writing to it. 2. List Index Out of Range (ERROR):

Error Message: litellm.BadRequestError: GetLLMProvider Exception - list index out of range Explanation: This is the critical error causing the program to crash. It occurs in the get_llm_provider function within the litellm library. The function attempts to split a string containing the model name using the "/" character (line 4353). However, the error message "list index out of range" suggests that the string being split might be empty or doesn't contain a "/" separator. Possible Causes for the List Index Out of Range Error:

Empty Model Name: The variable model might be empty before being passed to the get_llm_provider function. This could happen if the model selection process fails or isn't set properly. Invalid Model Name Format: The model name might not be formatted as expected. If the expected format is "/" and you provide just "", the split operation will result in an empty list and the error. Troubleshooting Steps:

Check Database Lock: Investigate why the database might be locked. There might be another process using it, or a connection issue that needs to be resolved. Examine Model Name Logic: Look at the code that sets the model variable before calling get_llm_provider. Ensure it's getting a valid and formatted model name. Review litellm Documentation: Check the documentation for the litellm library to see if there are specific requirements for the model name format. By addressing both the database lock issue and fixing the cause of the list index out of range error, your program should be able to function correctly.

RFARREY avatar Jul 17 '24 15:07 RFARREY