> For the complete documentation index, see [llms.txt](https://wiki.code-solutions.dev/serverassistantai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wiki.code-solutions.dev/serverassistantai/faqs-and-support/troubleshooting.md).

# Troubleshooting

If you encounter any issues while using ServerAssistantAI, try the following troubleshooting steps:

### API Keys and Tokens:

* Double-check that your API keys and tokens for the providers you're using (e.g., OpenAI, Cohere) are entered correctly in the `credentials.yml` file.
* Ensure that your API key/token has the necessary permissions to access the required models and endpoints.
* If you're using a separate Discord bot token, verify that it's entered correctly and that the bot has the necessary server and channel permissions in your server.
* If you've recently regenerated or updated your API keys or tokens, make sure to reload ServerAssistantAI for the changes to take effect.

### Configuration Files

* Review the files in the `plugins/ServerAssistantAI/discord/` and `plugins/ServerAssistantAI/minecraft/` directories to make sure the prompt format matches the chosen model.
* Pay special attention to the `prompt-header.txt`, `question-message.txt`, and `information-message.txt` files, as these can affect the AI's responses and behavior.
* Check to see if the `plugins/ServerAssistantAI/documents/` directory contains the necessary information files for your server. This directory can include multiple file types (.txt, .md, .pdf, .docx, .pptx, .xlsx) and is crucial for providing the AI with context-aware responses.
* Double-check your `config.yml` file for any misconfigurations or missing values.
* Verify that the `messages.yml` file is properly formatted and contains the expected keys and values for each message. Ensure that the MiniMessage format is used correctly for Minecraft messages and Discord formatting is applied correctly for Discord messages.

### Optional Dependencies:

* If you're using [PlaceholderAPI](https://ci.extendedclip.com/job/PlaceholderAPI/), ensure it's up-to-date and properly configured.
* Verify that the addons you're using with ServerAssistantAI are compatible with the plugin version, your server version, and properly installed.

### Cache and Database Files:

* If the AI's responses seem outdated or inconsistent, try deleting the files in the `plugins/ServerAssistantAI/cache/` directory and restarting your server.
* If you encounter database-related errors, check the files in the `plugins/ServerAssistantAI/database/` directory for any signs of corruption. You may need to delete these files and let the plugin regenerate them.
* After making changes to the files in the `plugins/ServerAssistantAI/documents/` directory, ensure that the cache is updated by reloading ServerAssistantAI or restarting your server.

### Console Errors:

* Check your server's console for any error messages related to ServerAssistantAI. These may provide clues about the source of the problem.
* If you see errors mentioning specific files or dependencies, double-check those components and ensure they're properly installed and configured.
* If you encounter errors related to HTTP requests or API calls, verify that your server has a stable internet connection, the required ports are open, and the API provider is not experiencing any outages or issues.
* If you see API errors or timeout messages, the AI provider's chat models may be temporarily down or experiencing issues. This is on the provider's end and typically resolves within a few hours. You can check the provider's status page for updates.

### Insufficient Permissions:

* If players are unable to use certain commands or features, please check whether the player has the required permission as listed in [Commands & Permissions](/serverassistantai/getting-started/commands-and-permissions.md).
* For Discord-related issues, check that the bot has the necessary permissions in your server's channel and role settings.
* Verify that players with the required permissions are correctly assigned to the appropriate groups or roles in the `config.yml` file.

### Minecraft Related Issues:

* Verify that players have the necessary permissions to ask questions in chat, as specified in the `config.yml` file.
* If you're using the `minecraft.bot_name` feature to force the AI to respond, make sure players are including the correct bot name in their messages.
* Check that the `minecraft.default_toggle_value` is set to `true` if you want the AI to automatically respond to player messages by default. Players can use the `/serverassistantai toggle` command to change this setting for themselves.
* If you've set `minecraft.send_replies_only_to_sender` to `true`, keep in mind that players can still ask questions in public chat, but the AI's responses will only be visible to the player who asked the question. Other players will not see the AI's response in chat.
* If the AI is not responding to questions in Minecraft chat, consider the following:
  * **Compatibility Issues**: If you're using Minecraft and the AI is not responding to questions in the chat, it could be due to compatibility issues with another plugin. To resolve this, you can use the `chat_listener` section in the `config.yml` file:

    ```yaml
    chat_listener:
      # Use the Paper modern AsyncChatEvent if available. Has no effect on Spigot servers.
      use_paper_event: true
      # Choose the priority level for the chat event listener. Options: LOWEST, LOW, NORMAL, HIGH, HIGHEST, MONITOR (default).
      priority: 'MONITOR'
      # Ignore the chat event if it is cancelled by another plugin.
      ignore_cancelled: true
    ```

    You should do the following steps in order until it works, you might not have to do all of them:

    * Set `use_paper_event` to `false`
    * Set `ignore_cancelled` to `false`
    * Set `priority` to `LOWEST`
  * **AI Toggle**: Check if you have toggled off the AI's responses using the `/serverassistantai toggle` command in Minecraft. If the toggle is set to off, the AI will not respond to your questions. Use the same command to toggle the AI's responses back on.
  * **Daily Limit**: Verify that you haven't reached your daily question limit. If you belong to a user group with a set limit and have already asked the maximum number of questions for the day, the AI will not respond to further inquiries.
  * **Minimum Words**: Double-check that your message meets the minimum word count requirement set in the `minimum_words` field of the `config.yml` file. If your question is too short, the AI may not recognize it as a valid inquiry.

### Discord Related Issues:

* If the AI is not responding to questions asked in Minecraft chat, check that the `discord.enabled` setting in the `config.yml` file is set to `true` and also check that the necessary channels are properly configured in the `config.yml` file.
* Verify that the AI has the required permissions to read messages and send responses in the designated channels.
* If you're using question detection on Discord, ensure that the detection settings and regex patterns in the `config.yml` file are correctly configured.
* Check that the `discord.bot_token` is correctly set in the `config.yml` file if you're using a separate Discord bot for ServerAssistantAI. If you're using DiscordSRV, make sure it's properly installed and configured.
* If the AI is not responding to questions on Discord, consider the following:
  * **AI Toggle**: Check if you have toggled off the AI's responses using the `/ai toggle` command on Discord. If the toggle is set to off, the AI will not respond to your questions. Use the same command to toggle the AI's responses back on.
  * **Skip Keyword**: If you include the skip keyword (set in the `skip_keyword` field of the `config.yml` file) and have the `skip_keyword_roles` in your message, the AI will intentionally not respond.
  * **Daily Limit**: Verify that you haven't reached your daily question limit. If you belong to a user group with a set limit and have already asked the maximum number of questions for the day, the AI will not respond to further inquiries.
  * **Minimum Words**: Double-check that your message meets the minimum word count requirement set in the `minimum_words` field of the `config.yml` file. If your question is too short, the AI may not recognize it as a valid inquiry.

### Logging and Debug:

* If you need to diagnose issues, enable logging in the `logging` section of `config.yml` and check the files in the `logs/` directory.
* Use the `/saai debug` command to generate diagnostic information about your configuration and system status to send to our support team.

{% hint style="danger" %}
If you're still having trouble after trying these steps, please reach out to our support team on [Discord](https://code-solutions.dev/discord) or submit an issue request on our [GitHub repository](https://github.com/CodeSolutionsDev/ServerAssistantAI/issues) if you believe it is a bug.
{% endhint %}
