Skip to content

Windows 微信 4.1.10.52:search 可读最近消息,但 sessions/timeline 因 raw key 获取失败不可用 #8

Description

@creamtea47

问题概述

在 Windows + 微信/Weixin 4.1.10.52 环境下,wechat-cli v1.6.19 目前只能部分读取数据:

  • search 可以通过 FTS 搜到最近几天的消息命中;
  • cache refreshsessionstimelinecontext 会因为当前 session.db / 消息库的新 salt 没有可用 key 而失败或降级。

也就是说,现在关键词搜索还能读到一部分最近消息,但正常的“最近会话列表”和“单个会话时间线读取”不可用。

环境信息

  • 系统:Windows amd64
  • 微信/Weixin:4.1.10.52
  • wechat-cli:1.6.19
  • 安装方式:release installer,入口为 %LOCALAPPDATA%\Microsoft\WindowsApps\wechat-cli.cmd
  • DB root:已配置,指向当前账号的 db_storage
  • 微信进程:已登录并运行中

当前状态

执行:

wechat-cli status --pretty

关键结果:

{
  "live_read_ok": true,
  "readiness": "degraded",
  "degraded_by": ["metadata_cache_stale"],
  "account": {
    "db_root_configured": true,
    "schema2_key_count": 20,
    "schema2_ready": true,
    "image_key_ready": false
  },
  "warnings": ["metadata_cache_degraded"]
}

复现步骤

1. 确认版本

wechat-cli --version

结果:

{"ok":true,"tool":"version","command":"version","data":{"name":"wechat-cli","version":"1.6.19"}}

2. 刷新 metadata cache

wechat-cli cache refresh --force --pretty

输出里出现:

no enc_key for salt ... in ...\db_storage\session\session.db
wxkey setup failed: no usable Windows WeChat raw keys found after scanning 5 process(es); ensure WECHAT_CLI_DB_ROOT matches the logged-in account

JSON 结果显示联系人能刷新,但 sessions 没刷出来:

{
  "ok": true,
  "data": {
    "errors": [
      {
        "rel_path": "session/session.db",
        "error": "wxkey setup failed: no usable Windows WeChat raw keys found after scanning 5 process(es); ensure WECHAT_CLI_DB_ROOT matches the logged-in account"
      }
    ],
    "stats": {
      "contacts": 21416,
      "sessions": 0,
      "snapshot_errors": 1,
      "snapshotted": 1,
      "source_dbs": 19
    }
  }
}

3. 最近会话列表为空

wechat-cli sessions --limit 5 --pretty

结果:

{
  "ok": true,
  "tool": "sessions",
  "command": "sessions",
  "data": {
    "query": {
      "command": "sessions",
      "has_more": false,
      "limit": 5,
      "tool": "sessions"
    }
  }
}

4. 对已解析 talker 读取 timeline 失败

wechat-cli timeline "<talker_wxid>" --limit 5 --pretty

输出里出现:

table Msg_<hash> not found in opened message shards; 2/2 shards could not be opened, first error: biz_message_0.db: wxkey setup failed: no usable Windows WeChat raw keys found after scanning 5 process(es)

no enc_key for salt ... in ...\db_storage\message\biz_message_0.db
no enc_key for salt ... in ...\db_storage\message\message_0.db

5. 但 FTS 搜索仍能返回最近消息

wechat-cli search "你好" --limit 3 --pretty

该命令返回 ok: true,能搜到 2026-06-13 / 2026-06-14 的最近消息命中。说明至少部分 live read / search 链路还能工作。

期望行为

当微信已登录,且 WECHAT_CLI_DB_ROOT / 已配置的 db_dir 指向当前账号时,cache refreshsessionstimelinecontext 应该能刷新或获取当前 session.dbmessage_0.dbbiz_message_0.db 对应 salt 的 schema-2/raw key。

实际行为

wechat-cli 多次尝试 Windows key setup,但无法找到可用 raw key,最终表现为:

  • contacts cache 可用;
  • sessions cache 为空;
  • search 部分可用;
  • timeline / context 读取当前 message shards 失败。

备注

  • 测试时微信/Weixin 进程已运行且处于登录状态。
  • 配置的账号目录在测试当天有更新。
  • issue 中已尽量脱敏账号 wxid、具体聊天正文和本地用户路径。

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededplatform: windowsWindows-specific install, packaging, or runtime behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions