matrix-fix

修复 Matrix Channel 常见问题:加密模块安装、token 过期处理、重新登录等。 Use when: Matrix channel 无法正常工作、加密模块报错、token 失效等问题。

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "matrix-fix" with this command: npx skills add boms/matrix-fix

Matrix Channel 修复指南

常见问题

1. 加密模块缺失

症状:

MatrixClientLite Failed to initialize crypto storage, E2EE disabled
Cannot find module '@matrix-org/matrix-sdk-crypto-nodejs'

修复:

cd /usr/local/lib/node_modules/openclaw
pnpm add @matrix-org/matrix-sdk-crypto-nodejs
pnpm rebuild @matrix-org/matrix-sdk-crypto-nodejs
openclaw gateway restart

2. Token 失效 (M_UNKNOWN_TOKEN)

症状:

errcode: 'M_UNKNOWN_TOKEN', error: 'Invalid access token passed.'

修复: 清除旧 token 并重启:

rm -rf ~/.openclaw/matrix/accounts/*
openclaw gateway restart

3. DNS 解析失败 (ENOTFOUND)

症状:

Error: getaddrinfo ENOTFOUND YOUR_HOMESERVER

检查:

host YOUR_HOMESERVER
ping YOUR_HOMESERVER

4. 重新配置 Matrix Channel

完整重置步骤:

  1. 移除旧配置:
openclaw config unset channels.matrix
  1. 重新设置配置:
openclaw config set channels.matrix.homeserver "https://YOUR_HOMESERVER:PORT"
openclaw config set channels.matrix.userId "@YOUR_BOT_USER_ID"
openclaw config set channels.matrix.password "YOUR_PASSWORD"
openclaw config set channels.matrix.deviceName "YOUR_DEVICE_NAME"
openclaw config set channels.matrix.encryption true
openclaw config set channels.matrix.enabled true
  1. 重启 Gateway:
openclaw gateway restart

5. 退出所有房间

如果需要让 bot 退出所有房间:

# 获取 access_token
TOKEN=$(curl -s -X POST "https://YOUR_HOMESERVER:PORT/_matrix/client/r0/login" \
  -H "Content-Type: application/json" \
  -d '{"type":"m.login.password","user":"YOUR_BOT_USER","password":"YOUR_PASSWORD"}' | \
  jq -r '.access_token')

# 获取房间列表
curl -s -X GET "https://YOUR_HOMESERVER:PORT/_matrix/client/r0/joined_rooms" \
  -H "Authorization: Bearer $TOKEN" | jq '.'

# 逐一退出
for room in "ROOM_ID_1" "ROOM_ID_2"; do
  curl -s -X POST "https://YOUR_HOMESERVER:PORT/_matrix/client/r0/rooms/$room/leave" \
    -H "Authorization: Bearer $TOKEN"
done

6. 检查状态

openclaw channels status --probe
openclaw logs | grep -i matrix

诊断命令

命令用途
openclaw status查看整体状态
openclaw channels status查看渠道状态
openclaw channels status --probe探测渠道连通性
openclaw logs 2>&1 | grep -i matrix查看 Matrix 日志

配置示例

{
  "channels": {
    "matrix": {
      "enabled": true,
      "homeserver": "https://YOUR_HOMESERVER:PORT",
      "userId": "@YOUR_BOT_USER_ID",
      "password": "YOUR_PASSWORD",
      "deviceName": "YOUR_DEVICE_NAME",
      "encryption": true
    }
  }
}

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

qwencloud-model-selector

[QwenCloud] Recommend the best Qwen model and parameters. TRIGGER when: choosing between Qwen models, comparing Qwen model pricing, understanding Qwen model...

Registry SourceRecently Updated
General

deployment-manager

You are a deployment manager with expertise in release orchestration, deployment strategies, and production reliability. Use when: release orchestration and...

Registry SourceRecently Updated
General

Hk Stock Morning Report

Generate HK stock market morning report (股市晨報) for bank trading desks. Triggers: "生成晨报", "股市晨报", "今日股市", "港股晨報" 報告結構(5部分): 1. 市場回顧(恒指/科指/國指 + 強弱勢股) 2. 南下資金(總...

Registry SourceRecently Updated
General

Story Long Scan

长篇网文扫榜。分析起点、番茄、晋江等平台排行榜数据,提炼市场趋势与热门题材。 触发方式:/story-long-scan、/长篇扫榜、「长篇什么火」「起点排行」

Registry SourceRecently Updated
matrix-fix | V50.AI