๐ง Error Troubleshooting FAQ โ
โ ๏ธ Network is the root cause of 80% of problems โ API can't connect, Git can't pull, plugins can't install, it's most likely a network issue. When encountering any error, first check if you can access the external network (
curl -I https://www.baidu.com), if not, switch networks / enable proxy.
Listed in order of error frequency from highest to lowest. New users should prioritize the ๐ด Extremely High Frequency section. If you're unsure which category your problem falls into, first check the "๐ Error Troubleshooting Flowchart" at the end.
๐ด Extremely High Frequency Errors (Inevitable for New Users) โ
Covers scenarios 1โ6, the most common problems encountered by new users when deploying and using MaiBot for the first time.
Scenario 1: Configuration File Not Found or Incorrect Format โ
Error Symptoms โ
- MaiBot crashes immediately on startup
- Terminal prints TOML parsing error, e.g.
Invalid TOML syntax - Or prompts
FileNotFoundError: config/bot_config.toml - Or prompts
APIๅฏ้ฅไธ่ฝไธบ็ฉบ๏ผ่ฏทๅจ้ ็ฝฎไธญ่ฎพ็ฝฎๆๆ็APIๅฏ้ฅใ - Or prompts
APIๅบ็กURLไธ่ฝไธบ็ฉบ
Quick Self-Check Trio โ
1๏ธโฃ Does the configuration file exist? Check if bot_config.toml exists in config/ 2๏ธโฃ Is the TOML syntax correct? Strings need quotes, numbers don't, booleans are lowercase 3๏ธโฃ Have you used WebUI to modify it? WebUI automatically validates syntax and won't make errors
Solutions โ
Method 1 (Recommended): Modify Configuration via WebUI WebUI automatically creates and validates configuration without manually writing TOML, no errors:
- Start MaiBot, open browser and visit
http://localhost:8001 - Go to the "Configuration Management" page
- Fill in the content as prompted on the page and save
If MaiBot cannot start due to configuration errors, you can fix the critical errors to get the program running first, then adjust settings through WebUI.
Method 2: Manually Copy Example Files If WebUI is temporarily unavailable, copy the example files as a starting point:
cp config/bot_config.example.toml config/bot_config.toml
cp config/model_config.example.toml config/model_config.tomlMethod 3: Check TOML Syntax (Reference for Manual Editing)
# โ
Correct examples
[bot]
nickname = "้บฆ้บฆ" # Strings need quotes
port = 8001 # Numbers don't need quotes
enabled = true # Booleans are lowercase
# โ Incorrect examples
[bot]
nickname = ้บฆ้บฆ # Error! No quotes
port = "8001" # Error! Numbers shouldn't have quotes
enabled = True # Error! Should be lowercase trueMethod 4: Online Validation If you've manually edited the file and aren't sure about the format, use an online TOML validator to check.
Prevention Tips โ
- ๐ Use WebUI to modify configuration โ WebUI automatically validates syntax, no errors
- ๐พ Backup before modifying โ
cp bot_config.toml bot_config.toml.bak - ๐ Make small changes โ Only modify a few lines at a time, test if startup works after saving
Scenario 2: API Key Error / Insufficient Balance โ
Error Symptoms โ
- Bot completely unresponsive
- Backend log shows
401 Unauthorized/402 Payment Required/403 Forbidden - Log prompts
API key is invalidorInsufficient balance
Quick Self-Check Trio โ
1๏ธโฃ Is the API Key filled in correctly? Check api_key field in model_config.toml 2๏ธโฃ Is the account balance sufficient? Log into the API provider's dashboard to check balance 3๏ธโฃ Is the model name correct? Check if model_identifier is in the provider's supported model list
Solutions โ
Step 1: Check API Key Configuration
# model_config.toml
[[api_providers]]
name = "DeepSeek"
base_url = "https://api.deepseek.com"
api_key = "sk-your-api-key-here" # Required! Replace with your actual key
auth_type = "bearer"Step 2: Verify Key is Valid
# Test DeepSeek API
curl https://api.deepseek.com/v1/models \
-H "Authorization: Bearer sk-your-api-key-here"Step 3: Check Balance
- Log into DeepSeek/OpenAI or other provider's dashboard
- Check if account balance is greater than 0
- Check if API Key has expired or been disabled
Step 4: Confirm Model Name
# โ
Correct example
[[models]]
model_identifier = "deepseek-chat" # Must be a model name supported by the API provider
name = "deepseek-chat"
api_provider = "DeepSeek"
# โ Incorrect example
[[models]]
model_identifier = "gpt-4" # DeepSeek does not support GPT-4!
api_provider = "DeepSeek"Prevention Tips โ
- ๐ Don't commit Keys to Git โ Use environment variables or local configuration files
- ๐ฐ Set up balance alerts โ Enable low-balance email notifications in the API dashboard
- ๐ Monitor usage โ Regularly check token consumption
Scenario 3: Port Occupied โ
Error Symptoms โ
- Startup reports
OSError: [Errno 98] Address already in use - Or
[Errno 10048](Windows) - Error log:
็ซฏๅฃ 8001 ๅทฒ่ขซๅ ็จ (host=127.0.0.1)
Quick Self-Check Trio โ
1๏ธโฃ Which process is occupying the port? Check in Task Manager / Activity Monitor 2๏ธโฃ Can you close the occupying process? End the occupying process in Task Manager 3๏ธโฃ Can you change MaiBot's port? Edit the configuration file to use another port
Solutions โ
Method 1: End the Occupying Process Find the process occupying the port in Task Manager (Windows) or Activity Monitor (macOS) and end it. If you don't know which process is occupying it, simply restarting your computer can also free up the port.
Method 2: Change MaiBot's Port
# config/bot_config.toml
# WebUI port (default 8001)
[webui]
port = 8002 # Change to 8002 or another available port
# WebSocket port (default 8000)
[maim_message]
ws_server_port = 8001 # Change to 8001 or another available portMethod 3: Start with a Different Port Simply change the port in the configuration file and restart MaiBot. It's recommended to use less commonly used ports like 8002, 9000, etc.
Prevention Tips โ
- ๐ Document port assignments โ Avoid multiple services using the same port
- ๐ Check after restart โ Sometimes old processes aren't cleaned up, may need to manually end them after restart
- ๐ง Use non-standard ports โ e.g., change 8001 to 18001 to reduce conflict probability
Scenario 4: WebUI Page Won't Open โ
Error Symptoms โ
- Browser shows "This site can't be reached" or "Connection refused" when visiting
http://localhost:8001 - Page is blank or times out loading
- MaiBot is running but WebUI won't open
Quick Self-Check Trio โ
1๏ธโฃ Did MaiBot really start successfully? Check the terminal for errors 2๏ธโฃ Is the browser address correct? Default is http://localhost:8001 3๏ธโฃ Is the firewall blocking it? Windows Firewall / antivirus software may be blocking
Solutions โ
Step 1: Confirm MaiBot is Running Check the terminal window where MaiBot is running, look for a log message like this:
WebUI ๆๅกๅจ ๅฏๅจๆๅ: http://127.0.0.1:8001If you don't see this, MaiBot hasn't fully started yet. Resolve the startup error first.
Step 2: Check Address and Port
- Default address:
http://127.0.0.1:8001(recommend using 127.0.0.1 instead of localhost) - If you changed the port, use your modified port
- If deploying on a remote server, replace
127.0.0.1with the server's IP
Step 3: Check Firewall
- Windows: Open "Windows Security" โ "Firewall & network protection" โ "Allow an app through firewall", ensure Python is allowed
- macOS: System Settings โ Network โ Firewall, check if Python is blocked
- Linux: Check iptables or ufw rules
Step 4: Check if Port is Occupied If the port is taken by another program, WebUI won't start. Refer to Scenario 3 for checking port occupancy.
Prevention Tips โ
- ๐ฅ๏ธ Check logs after startup โ Open the browser only after seeing "WebUI server started successfully"
- ๐ง Always use 127.0.0.1 โ More stable than localhost, avoids DNS resolution issues
- ๐ก๏ธ Temporarily disable firewall โ If you're sure it's safe, temporarily disable the firewall for testing
Scenario 5: MCP Configuration Error โ
Error Symptoms โ
- Startup reports
MCP ๆๅกๅจ {name} ไฝฟ็จ stdio ๆถๅฟ ้กปๅกซๅ command - Or
MCP ๆๅกๅจ {name} ไฝฟ็จ streamable_http ๆถๅฟ ้กปๅกซๅ url - Or log shows
MCP server xxx failed to connect
Quick Self-Check Trio โ
1๏ธโฃ Is the server address correct? Check mcp.servers[].url or command field 2๏ธโฃ Does the Token/Secret match? Confirm bearer_token matches the MCP server 3๏ธโฃ Is the MCP service running? Confirm the server has started and is accessible
Solutions โ
Step 1: Check MCP Configuration
# config/bot_config.toml
[mcp]
enable = true
# STDIO type (local process communication)
[[mcp.servers]]
name = "local-filesystem"
enabled = true
transport = "stdio"
command = "node" # Required! Startup command
args = ["/path/to/mcp-server/index.js"] # Command arguments
# HTTP type (remote service)
[[mcp.servers]]
name = "remote-search"
enabled = true
transport = "streamable_http"
url = "https://mcp-search.example.com/sse" # Required! HTTP endpoint
[mcp.servers.authorization]
mode = "bearer"
bearer_token = "your-bearer-token-here" # Required! Authentication tokenStep 2: Verify MCP Service is Accessible
# Test HTTP type MCP
curl -v https://mcp-search.example.com/sse \
-H "Authorization: Bearer your-bearer-token-here"
# Test STDIO type MCP
node /path/to/mcp-server/index.js
# You should see the MCP service startup logStep 3: Check Common Errors
# โ Error example 1: stdio mode missing command
[[mcp.servers]]
transport = "stdio"
command = "" # Error! Must specify startup command
# โ Error example 2: HTTP mode missing url
[[mcp.servers]]
transport = "streamable_http"
url = "" # Error! Must specify HTTP endpoint
# โ Error example 3: Bearer auth missing Token
[mcp.servers.authorization]
mode = "bearer"
bearer_token = "" # Error! Must specify TokenPrevention Tips โ
- ๐ Check each config item โ Refer to the MCP server documentation to confirm parameters
- ๐ Test before deploying โ Use
curlto test connectivity before configuring in MaiBot - ๐ Document Token changes โ Update MaiBot configuration synchronously when Token changes
Scenario 6: Bot Not Replying to Messages โ
Error Symptoms โ
- Message has been sent to the platform (QQ group / private chat)
- Bot has no response at all
- No errors in logs, but still no reply
Quick Self-Check Trio โ
1๏ธโฃ Check the backend terminal output โ did it show a message received prompt? 2๏ธโฃ Was a rule matched? Check if keyword/intent rules cover this message 3๏ธโฃ Is the LLM configuration correct? Confirm API Key and model configuration are correct (refer to Scenario 2)
Solutions โ
Step 1: Check Terminal Output Restart MaiBot and observe the terminal logs, see if there are:
ๆถๅฐๆถๆฏ๏ผ...(shows the message reached MaiBot)ๆญฃๅจ่ฐ็จ LLM...(shows it's requesting AI)ๅ้ๅๅค๏ผ...(shows the reply was sent) If all of these appear, MaiBot itself is fine โ it might be a platform permission or network issue.
Step 2: Check Reply Rules
# Check keyword rules
[[keyword_reaction.keyword_rules]]
keywords = ["ไฝ ๅฅฝ", "hello"] # Make sure it includes the message you sent
reaction = "ไฝ ๅฅฝๅ๏ผ"
enabled = true # Make sure the rule is enabledStep 3: Check Rate Limits
# config/bot_config.toml
[chat]
# Check if rate limits are too strict
reply_frequency_limit = 10 # Max 1 reply per 10 secondsStep 4: Check Platform Permissions
- QQ groups: Is the bot muted? Does it have permission to speak?
- Private chat: Has the bot been blocked?
- Adapter: Is NapCat connected normally?
Step 5: Test LLM Response
# Manually test the API
curl https://api.deepseek.com/v1/chat/completions \
-H "Authorization: Bearer sk-your-api-key-here" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-chat","messages":[{"role":"user","content":"ไฝ ๅฅฝ"}]}'
# You should receive a reply from the APIPrevention Tips โ
- ๐ Monitor logs โ Regularly check logs, handle anomalies promptly
- ๐งช Test new rules โ Test whether a rule works after adding it
- ๐ Document configuration changes โ Record changes after modifying reply rules
๐ก High Frequency Errors (Common) โ
Covers scenarios 7โ11, problems encountered relatively often during normal use.
Scenario 7: Plugin Loading Failed โ
Error Symptoms โ
- Startup reports
PluginLoadError, corresponding plugin is grayed out and unavailable in the plugin list - Log shows
ImportError,ModuleNotFoundError, orManifestValidationError - Plugin directory exists but no plugins are loaded
Quick Self-Check Trio โ
1๏ธโฃ First try reinstalling the plugin with the latest version 2๏ธโฃ Check the log for what dependencies are missing 3๏ธโฃ Confirm Python version is โฅ 3.10 and the plugin is compatible with the MaiBot version
Solutions โ
Step 1: Try a Different Version Re-download the plugin and choose a version compatible with your MaiBot version. Prioritize official plugins or popular community plugins โ they have better compatibility.
Step 2: Install Missing Dependencies Check the log for errors like No module named 'xxx'. If found, the plugin is missing dependencies. Run the following in the plugin directory:
cd plugins/your-plugin-directory
uv syncStep 3: Read the Full Error Log When starting MaiBot, pay attention to the complete error information in the terminal, look for prompts like:
No module named 'requests'Install whatever is indicated as missing.
Prevention Tips โ
- Check the documentation before installing a plugin to confirm compatible MaiBot version
- Prioritize official plugins or popular community plugins
- Regularly update plugins and MaiBot to the latest versions
Scenario 8: Database Error โ
Error Symptoms โ
- Runtime reports
DatabaseErrororOperationalError - Startup prompts database migration failed
- Log shows
database is lockedordisk I/O error
Quick Self-Check Trio โ
1๏ธโฃ Check if multiple MaiBot instances are running simultaneously connecting to the same database 2๏ธโฃ Check if disk space is full (open file manager to check) 3๏ธโฃ Confirm data/maibot.db file permissions are correct (readable and writable)
Solutions โ
Step 1: Resolve Database Locking
If the log shows database is locked, it means multiple MaiBot instances may be accessing the same database file simultaneously. Close the extra MaiBot processes and keep only one running.
If it's still locked after closing, try deleting the data/maibot.db file and starting fresh (remember to back up first).
Step 2: Repair Corrupted Database
If you suspect database corruption (e.g., after a sudden power outage):
- First back up: copy
data/maibot.dbto a safe location - Restart MaiBot โ the program will automatically rebuild or repair the database
- If that doesn't work, delete
data/maibot.dband let the program recreate it (important prior data needs to be restored from backup)
Step 3: Enable WAL Mode (Reduce Locking Conflicts)
[database]
# Enable WAL mode to reduce multi-process locking conflicts
journal_mode = "wal"Step 4: Clean Up Disk Space
Open the logs/ folder and delete unneeded old log files. If disk space is critically low, also check other directories for large files.
Prevention Tips โ
- Avoid running multiple MaiBot instances simultaneously connecting to the same database file
- Regularly back up
data/maibot.db(recommended weekly) - Configure log rotation to prevent log files from filling up the disk
- Use WAL mode to reduce locking conflicts
Scenario 9: Network Timeout / Connection Failure โ
Error Symptoms โ
- LLM request returns
APIConnectionErrororTimeoutErrorafter being unresponsive for a long time - Log shows
Connection refused,Connection reset, orRead timed out - Bot completely unresponsive, but local features work normally
Quick Self-Check Trio โ
1๏ธโฃ Test network connectivity (curl -v https://api.deepseek.com) 2๏ธโฃ Try a different network (e.g., switch to mobile hotspot) 3๏ธโฃ Confirm the timeout parameter isn't too small (recommended 60โ120 seconds)
Solutions โ
Step 1: Test Network Connectivity
# Test if the API endpoint is reachable
curl -v https://api.deepseek.comIf it connects (returning HTTP 200 or 401 both count as connected), the network is fine. If it times out or can't connect, your network route to the API provider is blocked โ try a different network.
Step 2: Increase Timeout
If the network is poor, set a longer timeout:
[[api_providers]]
name = "DeepSeek"
base_url = "https://api.deepseek.com"
api_key = "sk-your-api-key-here"
timeout = 120 # Single request timeout (seconds), can be set to 180 on poor networks
max_retry = 3 # Number of retries on failure
retry_interval = 8 # Retry interval (seconds)Step 3: Try a Different API Provider
If DeepSeek is unstable, add a backup API in the configuration:
[[api_providers]]
name = "DeepSeek"
base_url = "https://api.deepseek.com"
api_key = "sk-key-1"
[[api_providers]]
name = "Backup"
base_url = "https://api.openai.com/v1" # Replace with another API
api_key = "sk-your-backup-key"Prevention Tips โ
- Set reasonable
timeout(60โ120 seconds) andmax_retry(2โ3 times) - Try a different network when your network is unstable (e.g., switch to mobile hotspot)
- Configure multiple API providers as backups to avoid single points of failure
- Regularly check API provider status (follow official announcements)
Scenario 10: Emoji System Error โ
Error Symptoms โ
- Sending emoji commands has no effect
- Emoji generation fails, logs show
VLMErrororFilterError - Emoji registration fails, prompting quantity limit exceeded
Quick Self-Check Trio โ
1๏ธโฃ Confirm emoji.vlm_api_key is configured (if using VLM verification) 2๏ธโฃ Check if emoji.filter rules are too strict 3๏ธโฃ Ensure data/emojis/ directory is writable (correct permissions)
Solutions โ
Step 1: Check VLM Configuration
If using VLM for emoji verification, ensure the API Key is configured:
[emoji]
# VLM API Key (if using visual model for emoji verification)
vlm_api_key = "sk-your-vlm-key"Step 2: Adjust Emoji Filtering Rules
If emojis are being falsely filtered:
[emoji]
content_filtration = false # Temporarily disable filtering to check if it's a rule issueStep 3: Check Directory Permissions
Ensure the data/emojis/ directory is writable. If permissions are wrong, right-click and set read/write permissions in the file manager.
Step 4: Adjust Emoji Quantity Limit
If prompted that the registration quantity has exceeded the limit:
[emoji]
emoji_send_num = 25 # Number of candidates sent at once (1-64)
max_reg_num = 64 # Maximum number of registered emojis
do_replace = true # Replace old emojis when limit is reachedPrevention Tips โ
- Temporarily disable VLM verification during first use to check if it's a model issue
- Enable
content_filtrationcautiously to avoid false filtering of normal emojis - Regularly clean the
data/emojis/directory, remove unused emojis - Set a reasonable
max_reg_numto avoid taking up too much storage space
Scenario 11: Knowledge Graph / Memory System Error โ
Error Symptoms โ
- Bot replies "I don't remember" or "No relevant information found"
- Log prompts knowledge file loading failed
- Memory added but cannot be retrieved
Quick Self-Check Trio โ
1๏ธโฃ Run maibot knowledge rebuild to rebuild the knowledge index 2๏ธโฃ Check if files in data/knowledge/ directory are intact 3๏ธโฃ Confirm knowledge.enabled is true
Solutions โ
Step 1: Rebuild Knowledge Index
# Use CLI command to rebuild index
maibot knowledge rebuild
# Or click the "Rebuild Index" button in WebUIStep 2: Check Knowledge Files
# View the knowledge directory
ls -la data/knowledge/
# Confirm file format is correct (JSON or TXT)
# Corrupted files will cause loading failuresStep 3: Enable the Knowledge System
Confirm the knowledge system is enabled in the configuration file:
[knowledge]
enabled = trueStep 4: Limit Single Knowledge Entry Length
If knowledge is too long and exceeds the embedding model's token limit:
[knowledge]
# Maximum length of a single knowledge entry (Token count)
max_chunk_size = 512
# Knowledge chunk overlap size (to avoid context breaks)
chunk_overlap = 50Step 5: Check Vector Database
If the index is corrupted, delete the contents of data/vector_index/ directory, then rebuild:
maibot knowledge rebuildPrevention Tips โ
- Control the length of individual entries when adding knowledge to avoid exceeding the embedding model's token limit
- Rebuild the knowledge index periodically to keep the index synchronized with knowledge files
- Back up
data/knowledge/anddata/vector_index/directories - Use WebUI's knowledge management features to avoid manually editing knowledge files
๐ข Medium Frequency Errors (Specific Scenarios) โ
Covers scenarios 12โ17, problems encountered only in specific operations or configuration scenarios.
Scenario 12: WebUI Login Failed / Token Expired โ
Error Symptoms โ
- Opening WebUI page automatically redirects back to login page
- After entering password, prompts "Login failed" or "Incorrect password"
- API requests return
401 Unauthorizederror - Browser console shows
Token expiredorInvalid session
Quick Self-Check Trio โ
1๏ธโฃ Clear browser cache โ Cookie/LocalStorage may have expired or become corrupted 2๏ธโฃ Check if password is correct โ Confirm uppercase/lowercase and special characters are entered correctly 3๏ธโฃ Check WebUI service status โ Confirm the service is running and hasn't been restarted
Solutions โ
Method 1: Clear Cookies and Re-login
# Browser operations:
# 1. Press F12 to open Developer Tools
# 2. Go to Application โ Cookies
# 3. Delete all MaiBot-related Cookies
# 4. Refresh the page and re-loginMethod 2: Restart WebUI Service
# If password or secret_key has been modified, restart the service
# Docker deployment
docker restart maibot
# Source deployment
# First stop the current process (Ctrl+C), then restart
python bot.pyMethod 3: Check secret_key Configuration
# Edit config/bot_config.toml
[webui]
secret_key = "your-secret-key-here" # Ensure it remains consistent with previous value
session_expire = 7 # Session validity (days), default 7 daysโ ๏ธ Note: Modifying
secret_keywill invalidate all logged-in sessions, requiring re-login.
Prevention Tips โ
- Extend session validity โ Change
session_expireto 30 days - Keep secret_key fixed โ Don't change it frequently, otherwise you'll have to re-login each time
- Use browser bookmarks โ Save the page after logging in to avoid re-entering the password
Scenario 13: Platform Bot Account Not Configured โ
Error Symptoms โ
- Messages cannot be sent on a platform (e.g., QQ)
- Log prompts
No bot account configured for platform qq - Adapter is connected but bot is unresponsive
- Message sending fails, returns
400 Bad Request
Quick Self-Check Trio โ
1๏ธโฃ Check platform configuration โ Confirm platforms.qq.bot_accounts is filled in 2๏ธโฃ Verify account credentials โ Confirm Token/password is correct and hasn't expired 3๏ธโฃ Check adapter logs โ Confirm the adapter is connected normally
Solutions โ
Step 1: Configure Bot Account
# Edit config/bot_config.toml
[platforms.qq]
enabled = true
# Add bot account configuration
[[platforms.qq.bot_accounts]]
uin = "123456789" # Bot QQ number
token = "your-bot-token" # Bot Token (fill in according to adapter type)
# If using NapCat adapter, also configure:
[[platforms.qq.bot_accounts]]
uin = "123456789"
adapter = "napcat"
napcat_uin = "987654321" # NapCat logged-in QQ numberStep 2: Check Adapter Connection
# View adapter logs
# Docker deployment
docker logs maibot | grep -i adapter
# Source deployment
# Observe terminal output, look for "Adapter connected" related logsStep 3: Verify Account Credentials
- QQ platform โ Confirm the QQ number can log into NapCat/GoCQQ normally
- WeChat platform โ Confirm the Token hasn't expired and permissions are correct
- Other platforms โ Refer to the corresponding adapter's documentation
Prevention Tips โ
- Use a secondary account โ Avoid the risk of your main account being banned
- Update credentials regularly โ Replace Token before it expires
- Configure backup accounts โ Can quickly switch if the primary account has issues
Scenario 14: Invalid Regular Expression โ
Error Symptoms โ
- Startup or saving configuration reports
re.error: bad escapeetc. - Log prompts
Invalid regex patternorๆญฃๅ่กจ่พพๅผ็ผ่ฏๅคฑ่ดฅ - Keyword rules / message filtering don't work
- Configuration page shows "Save failed: regex syntax error"
Quick Self-Check Trio โ
1๏ธโฃ Check special character escaping โ Whether \. \* \+ etc. special characters have backslashes 2๏ธโฃ Check bracket matching โ Whether () [] {} are properly paired 3๏ธโฃ Use online tool to test โ Verify the regex with regex101.com
Solutions โ
Method 1: Use Online Regex Testing Tool
# Visit https://regex101.com/
# 1. Enter your regex pattern on the left
# 2. Enter test text below
# 3. Check if there are errors and adjustMethod 2: Escape Special Characters
# Error example: not escaped
ban_msgs_regex = ["\d{17}[\dXx"] # Square brackets not closed
# Correct example: escaped and closed
ban_msgs_regex = [
"\\d{17}[\\dXx]", # ID number (double backslash required in TOML)
"1[3-9]\\d{9}", # Phone number
"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}", # Email
]Method 3: Use Plain Strings Instead of Regex
# If complex matching isn't needed, plain strings are safer
ban_words = ["ๅนฟๅ", "ๅ ๅพฎไฟก", "ๅ
ผ่"] # Simple keywords, no regex needed
# Avoid writing complex regexes
# ban_msgs_regex = ["(ไปๅคฉ | ๆๅคฉ | ๅๅคฉ).*(ๅคฉๆฐ | ๆฐๆธฉ)"] # Error-prone
# Use keyword matching instead
ban_words = ["ๅคฉๆฐ", "ๆฐๆธฉ", "ๆธฉๅบฆ"]๐ก Tip: Regex in TOML files requires double backslashes
\\for escaping because\itself is a TOML escape character.
Prevention Tips โ
- Prefer keyword matching โ Simple scenarios don't need regex
- Test complex regex separately โ Validate on regex101.com first before putting it into config
- Add explanatory comments โ Add comments next to regex to describe what it matches, making maintenance easier
Scenario 15: Keyword Rule Configuration Error โ
Error Symptoms โ
- Message matches the wrong reply rule
- Rule doesn't take effect at all, bot doesn't reply
- Priority conflicts, high-priority rules override low-priority ones
- Mixed Chinese/English punctuation causing matching failure
Quick Self-Check Trio โ
1๏ธโฃ Check rule priority โ Higher priority rules override lower ones 2๏ธโฃ Confirm rule is enabled โ Is enabled = true set? 3๏ธโฃ Test punctuation โ Full-width / half-width symbol differences can affect matching
Solutions โ
Step 1: Check Keyword Rule Configuration
# Edit config/bot_config.toml
[keyword_reaction]
# Pure keyword rules
[[keyword_reaction.keyword_rules]]
keywords = ["ไฝ ๅฅฝ", "hello", "ๅจ"]
regex = []
reaction = "ไฝ ๅฅฝๅ๏ผๆไปไนๅฏไปฅๅธฎไฝ ็ๅ๏ผ"
priority = 10 # Priority, higher number = higher priority
enabled = true # Ensure rule is enabled
# Pure regex rules
[[keyword_reaction.regex_rules]]
keywords = []
regex = ["(ๆฉๅฎ | ๆฉไธๅฅฝ | ๆฉ [ไธๅ].*)"]
reaction = "ๆฉไธๅฅฝ๏ผไปๅคฉๅๆฏ็พๅฅฝ็ไธๅคฉ~"
priority = 20
enabled = true
# Keyword + regex mixed rules
[[keyword_reaction.keyword_rules]]
keywords = ["ๅคฉๆฐ"]
regex = ["(ไปๅคฉ | ๆๅคฉ | ๅๅคฉ).*(ๅคฉๆฐ | ๆฐๆธฉ | ๆธฉๅบฆ)"]
reaction = "่ฎฉๆ็็ๅคฉๆฐ้ขๆฅ..."
priority = 15
enabled = trueStep 2: Adjust Priorities
# Priority examples:
# priority = 30 โ Highest priority (exact match)
# priority = 20 โ Medium priority (regex match)
# priority = 10 โ Default priority (normal keywords)
# priority = 1 โ Lowest priority (fallback rule)
# Ensure important rules have higher priority than general rules
[[keyword_reaction.keyword_rules]]
keywords = ["ๅธฎๅฉ", "help"]
reaction = "ๆๅฏไปฅๅธฎไฝ ..."
priority = 30 # High priority, ensure preferential matching
[[keyword_reaction.keyword_rules]]
keywords = ["ๅ", "ๅข", "ๅง"] # General question words, lower priority
reaction = "่ฟไธชๅ..."
priority = 5Step 3: Test Punctuation Differences
# Full-width punctuation (Chinese input method)
keywords = ["ไฝ ๅฅฝ๏ผ", "ไฝ ๅฅฝ๏ผ"] # Different commas
# Half-width punctuation (English input method)
keywords = ["hello,", "hello!"]
# Recommended to configure both types of punctuation
keywords = ["ไฝ ๅฅฝ๏ผ", "ไฝ ๅฅฝ๏ผ", "hello", "hello!"]Prevention Tips โ
- Add comments to rules โ Comment the purpose next to each rule
- Hierarchical priority management โ Exact match > Regex match > Normal keywords > Fallback rule
- Test rules regularly โ Send test messages in the group to verify matching
- Use debug mode โ Enable
DEBUGlogging to see the actual matching chain
Scenario 16: Git Operation Failed (WebUI) โ
Error Symptoms โ
- Knowledge base sync / Git mirror operation fails in WebUI
- Log shows
Git clone failedorPermission denied - SSH Key verification fails with
Host key verification failed - Git LFS files are too large causing timeout
Quick Self-Check Trio โ
1๏ธโฃ First check network โ Can you access GitHub/Gitee? 2๏ธโฃ Try a public repository โ Does a repo that doesn't require login work? 3๏ธโฃ Is the repository too large? โ Large files can cause timeout
Solutions โ
Step 1: Confirm Network Connectivity Check if you can open GitHub or Gitee websites. If not, there's a network issue โ resolve that first.
Step 2: Try a Repository That Doesn't Require Login If you get a permission error (Permission denied), try a public repository (one that doesn't need SSH Key) in WebUI. If the public repository syncs normally, it's an SSH permission configuration issue โ check your SSH Key settings on GitHub/Gitee.
Step 3: Adjust Git Timeout Configuration If the repository is large, increase the timeout in config/bot_config.toml:
[git_mirror]
timeout = 300 # Git operation timeout (seconds), default 300 seconds
max_file_size = 100 # Maximum single file size (MB), files larger than this will be skippedPrevention Tips โ
- Test with a public repository first โ Switch to a private repo only after confirming sync works
- Avoid large files โ Don't put large binary files in the repository
Scenario 17: Log Files Too Large / Disk Space Full โ
Error Symptoms โ
- System running slowly or crashing
- Log rotation fails with
No space left on device - Disk usage 100%, cannot write new files
- MaiBot startup fails, prompting database locked or write failure
Quick Self-Check Trio โ
1๏ธโฃ Check disk space โ Open file manager to see how much space is left 2๏ธโฃ Check log file size โ See how large the logs/ folder is 3๏ธโฃ Check log level โ DEBUG level generates a large amount of logs
Solutions โ
Step 1: Clean Up Log Files Open the logs/ folder and delete unneeded old log files. Generally, only the last few days of logs need to be kept โ previous ones can be deleted directly.
Step 2: Configure Log Rotation
# Edit config/bot_config.toml
[logging]
level = "INFO" # Use INFO for production, DEBUG for debugging
max_bytes = 10485760 # Maximum 10MB per single file
backup_count = 5 # Keep 5 backup files
enable_rotation = true # Enable log rotationStep 3: Clean Up Other Junk Files
- Docker users: Clean up unused images and containers to free space
- Check
~/.cache/directory, delete any unneeded cache files
Step 4: If Still Not Working, Use a Different Drive If the current disk is indeed too small, consider moving MaiBot's logs and data directories to a larger disk.
Prevention Tips โ
- Use INFO level in production โ Avoid excessive DEBUG logs
- Configure log rotation โ Limit log file size and count
- Regular cleanup โ Set up crontab to automatically clean old logs weekly
- Mount to separate disk โ Mount the log directory to a separate disk partition
- Monitor disk space โ Set up alerts, notify when usage exceeds 80%
โช Low Frequency Errors (Rare) โ
Covers scenarios 18โ19, problems rarely encountered but may appear in special operations.
Scenario 18: Person/User System Data Anomaly โ
Error Symptoms โ
- User profile loading fails in WebUI, shows blank or error
- Character card information lost, previously set personality/background is gone
- When binding accounts, prompts "User already exists" or "Foreign key constraint failed"
Quick Self-Check Trio โ
1๏ธโฃ Did you directly modify the SQLite database file? 2๏ธโฃ Is the JSON format of character cards in data/persons/ folder correct? 3๏ธโฃ Are there multiple MaiBot instances accessing the same database simultaneously?
Solutions โ
Rebuild User Index
maibot person rebuildCheck Character Card Format
# Enter the character card directory
cd data/persons/
# Validate JSON format (using a character as an example)
python -m json.tool "character-name.json" > /dev/nullRepair Database (Proceed with Caution)
# Backup database
cp data/maibot.db data/maibot.db.bak
# Use WebUI to manage users, do not operate on the database directlyPrevention Tips โ
- ๐ฅ๏ธ Use WebUI for management โ Don't modify the database file directly
- ๐พ Back up regularly โ
data/persons/anddata/maibot.dbare important - ๐ Avoid concurrent access โ Don't start multiple MaiBot instances connecting to the same database
Scenario 19: Adapter WebSocket Disconnect Reconnect Loop โ
Error Symptoms โ
Adapter logs continuously:
[WebSocket] Connection closed, reconnecting...
[WebSocket] Reconnecting in 3s...
[WebSocket] Connection established
[WebSocket] Connection closed, reconnecting...Message sending and receiving is unstable, sometimes works and sometimes doesn't.
Quick Self-Check Trio โ
1๏ธโฃ Is the adapter.ws_url address and port correct? 2๏ธโฃ Is the network stable? (Between server and adapter) 3๏ธโฃ Is the server-side WebSocket service running normally?
Solutions โ
Check WebSocket Address
# Open the adapter configuration file
[adapter]
ws_url = "ws://127.0.0.1:8000" # Ensure the address and port are correctAdjust Reconnect Interval
[adapter]
reconnect_interval = 5 # Increase the interval to avoid frequent reconnection (unit: seconds)Check Server Status Check MaiBot's terminal output to confirm the WebSocket service is running normally (you should see logs like WebSocket ๆๅกๅฏๅจๆๅ).
Enable Heartbeat Keepalive (Advanced) If the network environment is poor, enable heartbeat in the adapter configuration:
[adapter]
enable_heartbeat = true
heartbeat_interval = 30 # Send a heartbeat every 30 secondsPrevention Tips โ
- ๐ Ensure network stability โ The network between server and adapter should be reliable
- ๐ Enable heartbeat detection โ Recommended for long connections to keep alive
- ๐ Monitor logs โ Investigate promptly if frequent reconnection is detected
- ๐ Consider using process management โ systemd/supervisor can automatically restart services
โก Error Code Quick Reference โ
Quickly locate the corresponding scenario by common keywords in error logs.
HTTP Status Code Quick Reference โ
HTTP 400 Bad Request ๐ง Severe โ Scenario 13: Platform Bot Account Not Configured โ Request parameter error, message sending failed
HTTP 401 Unauthorized ๐ฅ Fatal โ Scenario 2: API Key Error / Insufficient Balance โ API Key invalid or missing
HTTP 401 Unauthorized ๐ง Severe โ Scenario 12: WebUI Login Failed / Token Expired โ Session expired or Token invalid
HTTP 402 Payment Required ๐ง Severe โ Scenario 2: API Key Error / Insufficient Balance โ Account balance insufficient
HTTP 403 Forbidden ๐ฅ Fatal โ Scenario 2: API Key Error / Insufficient Balance โ API Key insufficient permissions
HTTP 429 Too Many Requests ๐ง Severe โ Scenario 9: Network Timeout / Connection Failure โ Request frequency too high, rate limited
HTTP 500 Internal Server Error ๐ง Severe โ Scenario 9: Network Timeout / Connection Failure โ API server internal error
HTTP 502 Bad Gateway ๐ง Severe โ Scenario 9: Network Timeout / Connection Failure โ Gateway error, upstream service unreachable
HTTP 503 Service Unavailable ๐ง Severe โ Scenario 9: Network Timeout / Connection Failure โ Service temporarily unavailable (overload/maintenance)
Common Error Keyword Index โ
Address already in use / [Errno 98] / [Errno 10048] ๐ง Severe โ Scenario 3: Port Occupied โ Port is already in use by another process
APIConnectionError ๐ง Severe โ Scenario 9: Network Timeout / Connection Failure โ API connection failed
Connection refused / ๆ ๆณ่ฎฟ้ฎๆญค็ฝ็ซ ๐ฅ Fatal โ Scenario 4: WebUI Page Won't Open โ WebUI service not started or port unreachable
database is locked ๐ง Severe โ Scenario 8: Database Error โ Database locked by multiple processes
DatabaseError / OperationalError ๐ง Severe โ Scenario 8: Database Error โ Database operation exception
FileNotFoundError ๐ฅ Fatal โ Scenario 1: Configuration File Not Found or Incorrect Format โ Configuration file does not exist
FilterError ๐จ Warning โ Scenario 10: Emoji System Error โ Emoji filter rule false positive
ImportError / ModuleNotFoundError ๐ง Severe โ Scenario 7: Plugin Loading Failed โ Plugin dependency missing
No space left on device ๐ง Severe โ Scenario 17: Log Files Too Large / Disk Space Full โ Disk space insufficient
PluginLoadError ๐ง Severe โ Scenario 7: Plugin Loading Failed โ Plugin loading exception
re.error / bad escape ๐จ Warning โ Scenario 14: Invalid Regular Expression โ Regex syntax error
TimeoutError ๐ง Severe โ Scenario 9: Network Timeout / Connection Failure โ Request timeout
Token expired ๐จ Warning โ Scenario 12: WebUI Login Failed / Token Expired โ Login session expired
TOML syntax error ๐ฅ Fatal โ Scenario 1: Configuration File Not Found or Incorrect Format โ Configuration file format error
ValueError ๐ฅ Fatal โ Scenario 5: MCP Configuration Error โ MCP server configuration parameter invalid
VLMError ๐จ Warning โ Scenario 10: Emoji System Error โ Vision language model call failed
็ฅ่ฏๅ ่ฝฝๅคฑ่ดฅ ๐ง Severe โ Scenario 11: Knowledge Graph / Memory System Error โ Knowledge file corrupted or format error
Session ่ฟๆ ๐จ Warning โ Scenario 12: WebUI Login Failed / Token Expired โ Browser session expired
๐ Getting Help Guide โ
๐ค Self-Check Before Asking โ
Before asking for help, take 2 minutes to do the following checks โ most problems can be resolved on your own:
๐ 1. Consult the Official Documentation : Your problem has likely already been answered in various scenarios of this document. Search through it first โ it saves time and effort.
๐ 2. Check the Error Logs : The logs will specify the specific error cause and stack trace โ this is the primary clue for locating the problem. Don't know how to export them? See "How to Get Logs" below.
โ๏ธ 3. Review Recent Changes : Think back to what configuration you recently changed, what plugins you installed, or what versions you updated. Try reverting to the last working state to confirm if something was changed incorrectly.
๐ 4. Search Known Issues : Use error keywords to search GitHub Issues or search engines to see if others have encountered the same problem.
๐ Information Checklist for Submitting an Issue โ
When submitting an Issue on GitHub, please be sure to include the following information. Issues missing key information may be delayed:
๐ฅ๏ธ System and Environment : Operating system type and version, deployment method (source/Docker), Python version (for source deployment)
๐ข MaiBot Version : Run git log --oneline -1 to view the current commit, or get the version number from the bottom of WebUI
๐ Complete Error Logs : Log snippets containing the stack trace (traceback) โ don't just screenshot a small portion. See "How to Get Logs" below
โ๏ธ Related Configuration : Configuration content related to the problem (be sure to redact sensitive information like API Keys)
๐ฏ Reproduction Steps : Specific steps from startup to error occurrence โ the more detailed, the better
๐ Community Support Channels โ
๐ฌ QQ Group : Join the MaiBot user community to exchange experiences with other users. Group number: [Please fill in group number]
๐ฑ GitHub Issues : If you've confirmed it's a bug or feature suggestion, please submit at GitHub Issues. Remember to search first to avoid duplicates
๐ Official Documentation Site : For the latest and most comprehensive documentation, visit MaiBot Documentation Site
๐ฌ GitHub Discussions : For feature discussions and technical questions, visit GitHub Discussions to join the community conversation
๐ How to Get Logs โ
Depending on your deployment method, the way to get logs differs:
๐ Source Deployment : The terminal output where MaiBot is running is the most direct log. If the terminal has been closed, check the log files as follows:
cat logs/maibot-*.logIf you need more detailed logs, enable DEBUG level in config/bot_config.toml:
[log]
log_level = "DEBUG"๐ณ Docker Deployment : Use the docker logs command to view container logs:
# View all logs
docker logs maibot
# Continuously follow log output
docker logs -f maibot
# View only the last 100 lines
docker logs --tail 100 maibot๐ช Windows Deployment : Log files are located in the logs\ directory by default:
type logs\maibot-*.log
# Or using PowerShell
Get-Content logs\maibot-*.log๐ก Tip: After getting the logs, wrap them in a
```code block and paste them into the Issue. If the logs are very long, only include the section from the last startup to the error โ don't paste thousands of lines of complete logs.
๐ Error Troubleshooting Flowchart โ
Not sure which category your problem falls into? Follow the flowchart to find the corresponding section.