FAQ
This document summarizes common problems and solutions during MaiBot usage, organized by category, each containing symptoms, causes, and solution steps.
Startup Issues
EULA Not Confirmed on Startup
Symptom: MaiBot exits immediately after startup, console outputs agreement confirmation prompt, program won't continue initialization.
Cause: First use or after EULA/privacy agreement update, MaiBot requires users to explicitly agree to agreement content. System calculates MD5 hash values of EULA.md and PRIVACY.md, compares with records in eula.confirmed and privacy.confirmed files.
Solution:
- Run
uv run python bot.py, input同意orconfirmedin console prompt to confirm agreement - After confirmation, generates
eula.confirmedandprivacy.confirmedfiles in project root directory - Can also skip confirmation through environment variables: set
EULA_AGREEandPRIVACY_AGREEto corresponding file MD5 hash values - First access through WebUI, setup wizard will also guide through EULA confirmation
Configuration File Not Found / config Directory Doesn't Exist
Symptom: Startup error prompts bot_config.toml or model_config.toml doesn't exist, or cannot create configuration directory.
Cause: MaiBot's configuration files are located in config/ directory, will automatically create this directory on first startup. If directory permissions are insufficient or path is abnormal, configuration files cannot be loaded.
Solution:
- Confirm
config/directory exists in project root directory, MaiBot will automatically create it at startup (CONFIG_DIR.mkdir(parents=True, exist_ok=True)) - Configuration file paths are
config/bot_config.tomlandconfig/model_config.toml - MaiBot will automatically generate default configuration files on first startup
- If automatic generation fails, check directory write permissions
Python Version Incompatibility
Symptom: Startup error prompts syntax error (like match statement error), module missing or TypeError.
Cause: MaiBot requires Python 3.10 or higher (project Badge shows Python-3.10+), lower Python versions don't support match-case syntax and some type annotation features.
Solution:
- Use
python --versionto check current version, ensure >= 3.10 - Recommended to use
uvto manage dependencies and Python version:bashuv sync uv run python bot.py - If using system Python, please upgrade or use tools like
pyenvto manage multiple versions
Runner/Worker Process Startup Exception
Symptom: Program exits immediately after startup, or repeatedly restarts in Runner process.
Cause: MaiBot uses Runner (daemon process) + Worker (work process) architecture. Runner process starts Worker through subprocess.Popen, if Worker startup fails it will repeatedly retry. When Worker exit code is 42 (RESTART_EXIT_CODE), Runner will automatically restart.
Solution:
- View specific error information output to console
- If Worker exits due to configuration error, Runner will automatically restart after fixing
- Use
Ctrl+Cto stop Runner process
Configuration Issues
Model Unavailable / API Call Failed
Symptom: Maimai cannot reply to messages, logs show model call errors (like connection timeout, 401, 403, etc.).
Cause: API configuration in model_config.toml is incorrect, or API service is unavailable.
Solution:
- Check
[[api_providers]]configuration inmodel_config.toml, confirm API address (base_url) and key (api_key) are correct - Confirm
api_keyis valid and has sufficient call quota - Check network connection, ensure model API endpoint is accessible
- Confirm
api_providername referenced in[[models]]configuration matchesnamein[[api_providers]] - Model configuration loading will validate:
api_providerscannot be empty, names cannot duplicate, each model'sapi_providermust exist - Check model configuration for validation errors in WebUI configuration management page
API Key Error
Symptom: Logs show 401 or 403 errors.
Cause: API key is invalid, expired or has insufficient permissions.
Solution:
- Confirm API Key has no extra spaces or line breaks
- Check if API Key has expired or been revoked
- Confirm API Key has access permissions for corresponding models
- Note
api_keyfield inmodel_config.tomlis sensitive information (repr=False), don't leak to public network
Configuration File Format Error
Symptom: Startup reports TypeError or ValueError, prompts configuration parsing failed.
Cause: Manual editing of TOML files introduced syntax errors, or configuration item types don't match.
Solution:
- MaiBot uses
tomlkitto parse TOML files, has strict format requirements - Modifying configuration through WebUI will automatically save in correct format, recommended to use WebUI modification
- When manually editing note: strings need quotes, numbers don't need quotes, booleans use
true/false - If configuration file version doesn't match current version, MaiBot will automatically update configuration and backup old files to
config/old/directory - Configuration files must contain
[inner]section andversionfield
Configuration Changes Not Taking Effect
Symptom: Modified configuration but behavior hasn't changed.
Cause: Some configuration modifications require restart, some support hot reload.
Solution:
- MaiBot has built-in file watcher (
FileWatcher), will automatically hot reload after modifyingbot_config.tomlormodel_config.toml - Hot reload has debounce mechanism (600ms), frequent modifications will wait for stability before reloading
- If hot reload times out (20 seconds) or continuously fails, manual restart is needed
- Some deep configurations (like database path, port binding) require restart to take effect
Connection Issues
NapCat WebSocket Connection Failed
Symptom: NapCat cannot connect to adapter/MaiBot, or connection frequently drops.
Cause: NapCat and adapter/MaiBot WebSocket configurations don't match, depending on running mode.
Solution:
- Confirm
platformin[bot]section ofbot_config.tomlis set to"qq" - Confirm
qq_accountmatches NapCat login QQ number - Plugin Mode: Check adapter's
napcat_server.hostandnapcat_server.portsettings. Adapter connects to NapCat's Forward WebSocket server (typicallyws://127.0.0.1:3001). Verify NapCat has Forward WebSocket server enabled on the correct port. - Standalone Mode: Check adapter's
napcat_server.hostandnapcat_server.port(defaultlocalhost:8095). NapCat should connect to the adapter via Reverse WebSocket atws://127.0.0.1:8095. Also verify the adapter'smaibot_server.portmatches MaiBot's[maim_message].ws_server_portinconfig/bot_config.toml(default8000). - Confirm firewall doesn't block WebSocket connection
- Check if NapCat version is compatible with current MaiBot version
- View NapCat, adapter, and MaiBot logs for specific connection error information
Port Occupied
Symptom: Startup prompts port binding error (OSError: [Errno 98] Address already in use).
Cause: MaiBot used ports conflict with other services in system.
Solution:
- Message server port: modify
ws_server_portin[maim_message]section (default 8080) - WebUI port: modify
portin[webui]section (default 8001) - API Server port: modify
api_server_portin[maim_message]section (default 8090) - Find and close processes occupying ports:bash
# Linux/macOS lsof -i :8080 # Windows netstat -ano | findstr :8080 - MaiBot will automatically detect if ports are available at startup, and prompt corresponding configuration item locations
Message Send/Receive Exception
Symptom: Can receive messages but cannot send, or vice versa.
Cause: Platform IO routing configuration or NapCat permission issues.
Solution:
- Check robot permissions in group chat (whether muted)
- Confirm NapCat login status is normal (not disconnected or frozen)
- View Platform IO routing parsing logs in MaiBot logs
- Check if multiple instances are simultaneously connecting to same QQ number
- Check MaiBot logs for any message sending errors
Runtime Issues
Database Error / Database Locked
Symptom: MaiBot reports database is locked or other SQLite errors.
Cause: SQLite doesn't support multi-process concurrent writes, multiple instances simultaneously accessing same database will conflict.
Solution:
- Confirm no other MaiBot processes are running simultaneously
- Ensure only one instance accesses database file
- If lock files remain due to unexpected exit, delete
.lockfiles or-walfiles indata/directory - Database configuration is in
[database]section,save_binary_datacontrols whether to save voice and other binary data as separate files
High Memory Usage
Symptom: MaiBot memory keeps growing after running for a while.
Cause: Chat context, long-term memory index, embedding vectors and other data will occupy memory.
Solution:
- Adjust
max_context_sizein[chat]section (default 30), reduce context length - Adjust
[memory]related configurations, reduce memory retrieval range - If
[webui]'senable_paragraph_content(knowledge graph paragraph full content) is enabled, will additionally increase memory usage, recommended to enable only when needed - Plugins will start subprocesses when running, each plugin has independent memory space, pay attention to controlling plugin count
Large Reply Delay
Symptom: Message response time is too long.
Cause: Model API delay, context too long, multiple tasks processed serially, etc.
Solution:
- Check model API response speed, choose service providers with lower latency
- Appropriately reduce
max_context_sizein[chat]section - Check if there's additional delay caused by MCP tool calls (timeout settings in
[mcp]configuration) - Adjust
planner_interrupt_max_consecutive_countin[chat]section, avoid Planner being frequently interrupted - View time consumption of each step in logs to locate bottlenecks
WebUI Issues
WebUI Cannot Be Accessed
Symptom: Browser cannot open WebUI page.
Cause: WebUI not enabled, network configuration error or security policy restrictions.
Solution:
- Confirm WebUI is enabled (
enabled = truein[webui]section ofbot_config.toml) - Check if access address is correct (default
http://127.0.0.1:8001) - If binding is
0.0.0.0, ensure firewall allows external access - Check if IP whitelist is enabled (
allowed_ipsconfiguration, default127.0.0.1), confirm client IP is in whitelist - If strict anti-crawler mode is enabled (
anti_crawler_mode), confirm browser UA is not in block list - WebUI's
modesupportsdevelopmentandproduction, production environment should useproduction
Token Authentication Failed / Forgot Token
Symptom: Cannot login to WebUI, prompts Token invalid or not found.
Cause: Token is saved in data/webui.json, generated at first startup.
Solution:
- Token is generated at first startup and output to console, view startup logs
- Token is saved in
data/webui.jsonfile, can directly read - If still cannot obtain, delete
data/webui.jsonand restart MaiBot, system will regenerate Token - Note: deleting
webui.jsonwill reset authentication status and first setup flag
WebUI Port Binding Failed
Symptom: WebUI startup fails, logs prompt port binding error.
Cause: 8001 port is occupied by other services.
Solution:
- Modify
portin[webui]section ofbot_config.tomlto other port - Find and close processes occupying 8001 port
- If using reverse proxy, ensure frontend configuration points to correct port
- WebUI default binding is
127.0.0.1:8001, external access needs to modifyhostto0.0.0.0
Cookie Expired Needs Re-login
Symptom: After using for a while, WebUI requires re-entering Token.
Cause: Cookie validity expires, or security configuration doesn't match.
Solution:
- Cookie default validity is 7 days, needs re-verification after expiration
- If using HTTPS, ensure
secure_cookie = trueconfiguration is correct - Clear browser Cookie and re-login
- Production environment recommends configuring reverse proxy and enabling HTTPS
Plugin Issues
Plugin Installation Failed
Symptom: Error when installing plugins through WebUI.
Cause: Git unavailable, network issues or plugin repository format incorrect.
Solution:
- Confirm Git is installed and Git command is available (
git --version) - Check network connection, ensure access to GitHub or configured mirror sources
- If in GitHub restricted areas, configure mirror sources (WebUI → Plugin Management → Mirror Source Management)
- Confirm plugin repository address is correct, and repository contains
_manifest.jsonfile - View installation progress and error information pushed through WebSocket
- Plugin installation executes through
git clone, ensure Git security configuration is correct
Plugin Loaded But No Effect
Symptom: Plugin shows installed but doesn't produce expected effect.
Cause: Plugin not enabled, version incompatible or configuration incorrect.
Solution:
- Check if
enabledfield in plugin configuration istrue - View and modify plugin status through WebUI's plugin configuration page
- View if there are plugin loading errors in MaiBot logs
- Confirm plugin version is compatible with current MaiBot version
- Try resetting plugin configuration through WebUI and check effect
- Plugins have independent subprocesses and logs when running, check Runner and Worker health status