Skip to content

Troubleshooting FAQ

This document helps you solve common issues when using ChatAI Plugin.

Quick Search

Use Ctrl+F to search for error keywords, or browse by category.

Installation Issues

better-sqlite3 Build Failed

Error Message

Could not locate the bindings file or node-gyp rebuild failed

Solution Steps:

Step 1 - Rebuild in Yunzai root directory

bash
pnpm rebuild better-sqlite3

Step 2 - If still failing, install build tools

bash
# Install Visual Studio Build Tools
# Download: https://visualstudio.microsoft.com/visual-cpp-build-tools/
# Select "Desktop development with C++" during installation
npm install -g windows-build-tools
bash
sudo apt update
sudo apt install build-essential python3
bash
sudo yum groupinstall "Development Tools"
sudo yum install python3
bash
xcode-select --install

Step 3 - Clean reinstall

bash
rm -rf node_modules
pnpm install
pnpm rebuild better-sqlite3
Other Possible Solutions
bash
# Set Python path
npm config set python /usr/bin/python3

# Global install node-gyp
npm install -g node-gyp

# Clear cache and retry
pnpm store prune

Node.js Version Incompatible

Error Message

Startup errors like SyntaxError or abnormal behavior

Solution:

bash
# Check version (requires 18.0+)
node -v

# Switch version using nvm
nvm install 18
nvm use 18

# Or use fnm
fnm install 18
fnm use 18

Dependency Installation Failed

Error Message

pnpm install errors like ENOENT, EPERM, etc.

Solution:

bash
# Clear cache
pnpm store prune

# Delete lockfile and reinstall
rm pnpm-lock.yaml
pnpm install

Windows Users Note

If encountering permission issues, try running command line as Administrator

Startup Issues

Plugin Won't Load

Error Message

No [ChatAI] logs in console, or Cannot find module error

Checklist:

Check ItemDescriptionFix
Directory nameMust be plugins/chatgpt-pluginRename directory
Entry fileindex.js must existRe-clone plugin
DependenciesDependencies must be completeRun pnpm install
Console logsCheck detailed error messagesFix based on error

Web Panel Inaccessible

Error Message

Browser can't open admin panel link, shows connection timeout or refused

Troubleshooting Steps:

1. Check Port Usage

bash
netstat -tlnp | grep 3000
lsof -i :3000
powershell
netstat -ano | findstr :3000

2. Check Firewall

bash
sudo ufw allow 3000
bash
sudo firewall-cmd --add-port=3000/tcp --permanent
sudo firewall-cmd --reload
powershell
# Add inbound rule in Windows Firewall

3. Modify Listen Address

yaml
# config.yaml
web:
  host: "0.0.0.0"  # Allow external access (default 127.0.0.1 is local only)
  port: 3000       # Change port if occupied

Database Initialization Failed

Error Message

SQLITE_CANTOPEN or database is locked

Solution Steps:

bash
# 1. Rebuild better-sqlite3
pnpm rebuild better-sqlite3

# 2. Check directory permissions (Linux/macOS)
chmod 755 plugins/chatgpt-plugin/data

# 3. Delete database file and rebuild (will lose data!)
rm plugins/chatgpt-plugin/data/chatai.db

Data Backup

Backup data/ directory before deleting database to avoid data loss

Usage Issues

AI Not Responding

Symptom

Bot has no response after sending messages

Troubleshooting Flowchart:

Checklist:

Check ItemActionDescription
Trigger MethodConfirm correct trigger method@trigger, prefix trigger (e.g., #chat)
Channel ConfigCheck channel status in Web panelClick "Test Connection" to verify
Debug ModeSend #ai调试开启View detailed error info
Plugin ConflictsCheck if other plugins interceptAdjust plugin priority

API Authentication Failed (401/403)

Error Code

401 Unauthorized or 403 Forbidden

Possible CauseSolution
Wrong API KeyCheck if Key is copied completely, no extra spaces
Key ExpiredCheck Key status in provider dashboard
Insufficient BalanceRecharge account balance
Insufficient PermissionCheck Key's API access permissions
IP RestrictionSome providers restrict IPs, check if proxy needed

API Rate Limited (429)

Error Code

429 Too Many Requests or Rate limit exceeded

Solutions:

SolutionDescriptionRecommended
Multi-Channel Load BalancingConfigure multiple channels to distribute requests⭐⭐⭐
Increase Request IntervalSet requestInterval in config⭐⭐
Upgrade API PlanIncrease API quota limit⭐⭐⭐
Use Backup ChannelConfigure failover channel⭐⭐⭐

Duplicate Messages

Symptom

Same message receives multiple replies

Check ItemDescription
Duplicate AdaptersEnsure not running multiple Bot adapters simultaneously
Message EchoCheck echo config in config.yaml
Plugin DedupPlugin has built-in dedup mechanism

Tool Call Failed

Symptom

AI tries to call tool but returns error or no response

Troubleshooting Steps:

  1. Confirm Tool is Enabled

    • Web Panel → Tool Management → Check tool status
  2. Check Permission Config

    • Some tools require master or group admin permission
  3. View Tool Logs

    txt
    #工具日志
  4. Enable Debug Mode

    txt
    #ai调试开启
Common Tool Errors
ErrorCauseSolution
Tool not foundTool not enabled or doesn't existEnable tool in Web panel
Permission deniedInsufficient permissionCheck user permission config
TimeoutTool execution timeoutCheck network or tool logic

Performance Issues

Slow Response

Symptom

High AI response latency, long wait times

OptimizationDescriptionEffect
Reduce ContextLower context.maxMessages value⭐⭐⭐
Use Lighter Modele.g., gpt-4o-mini, deepseek-chat⭐⭐⭐
Enable StreamingSet stream: true⭐⭐
Optimize NetworkConfigure proxy or use domestic channels⭐⭐⭐

High Memory Usage

Symptom

Node.js process memory keeps growing

OptimizationConfiguration
Reduce context messagescontext.maxMessages: 10
Regularly clear historyUse #结束对话 command
Limit memory countmemory.maxMemories: 500
Disable unused featuresDisable unused tool categories

Proxy Issues

Proxy Connection Failed

Symptom

API request timeout or connection refused

Checklist:

Check ItemCommand/Action
Proxy service runningCheck if proxy software is started
Port correctConfirm port number (common: 7890, 1080)
Proxy typehttp/socks5 must match

Test Proxy Connectivity:

bash
# Test HTTP proxy
curl -x http://127.0.0.1:7890 https://api.openai.com/v1/models

# Test SOCKS5 proxy
curl -x socks5://127.0.0.1:1080 https://api.openai.com/v1/models

Some Requests Bypass Proxy

yaml
# config.yaml
proxy:
  enabled: true
  type: http        # http or socks5
  host: 127.0.0.1
  port: 7890
  noProxy: []       # Ensure target domains not excluded

MCP Issues

MCP Server Connection Failed

Symptom

MCP tools unavailable, status shows offline

Troubleshooting Steps:

  1. Check MCP Status

    txt
    #mcp状态
  2. Check npm Package Installation

    bash
    # Confirm MCP server package is installed
    npm list -g @anthropic/mcp-server-xxx
  3. Check Configuration File

    json
    // data/mcp-servers.json
    {
      "servers": {
        "my-server": {
          "command": "npx",
          "args": ["-y", "@xxx/mcp-server"]
        }
      }
    }

Tool Unavailable

Check ItemDescription
Server ConnectionConfirm MCP server status is online
Tool ListCheck if tool is in tools/list response
Permission ConfigCheck preset tool whitelist/blacklist

Logging

Enable Debug Mode

txt
#ai调试开启

Debug Mode Features

  • Shows detailed API request/response logs
  • Shows tool call details
  • Shows error stack traces

View Logs

bash
# Real-time log viewing
tail -f logs/latest.log

# Search error logs
grep -i "error\|fail" logs/latest.log
txt
#工具日志
txt
#mcp状态

Submit Issue

When Submitting Issues, Please Include

  1. Error Screenshot - Complete error stack trace
  2. Related Config - Config with API Key hidden
  3. Reproduction Steps - Detailed operation steps
  4. Environment Info - Node.js version, OS, Yunzai version

Common Error Codes

CodeDescriptionSolution
401Authentication FailedCheck if API Key is correct
403Permission DeniedCheck Key permission scope
429Too Many RequestsLower frequency or switch channels
500Server ErrorRetry later
502Gateway ErrorCheck proxy or retry later
503Service UnavailableWait for service recovery
ECONNREFUSEDConnection RefusedCheck network and proxy config
ETIMEDOUTConnection TimeoutCheck network or increase timeout

Get Help

🆘 Get Support

ChannelLinkUse Case
GitHub IssuesSubmit IssueBug reports, feature requests
DocumentationView DocsConfiguration and usage questions
QQ GroupSee project READMEDiscussion and chat

Released under the MIT License