设备连接报错
设备连接过程中可能出现的报错、解决方案及说明
本文档汇总 AstroBox 在设备连接全流程中可能向用户展示的报错信息,包括 Toast 弹窗、队列内嵌错误、Rust 后端返回错误及逻辑层抛错。常见报错与解决方案已置顶,完整清单见文末。
常见报错与解决方案
连接失败:Auth HMAC mismatch, This usually means your AuthKey is wrong.
报错原文
连接失败:Auth HMAC mismatch, This usually means your AuthKey is wrong.(日志末尾可能附带 Backtrace capture disabled. Set RUST_LIB_BACKTRACE=1 to enable. 提示,这是 Rust 的调试提示,不是报错本身。)
触发场景:连接设备时 AuthKey 错误,设备拒绝握手。
解决方案:AuthKey 错误,请重新从小米账号获取,或重新确认 AuthKey 的有效性。
源码位置:modules/core/src/device/xiaomi/components/auth.rs:254
vivo file_v2: send ack receiver dropped
报错原文
vivo file_v2: send ack receiver dropped触发场景:vivo 设备传输过程中发送 ACK 确认时接收端已关闭,通常由设备断联导致。
解决方案:设备断联,检查设备连接状态,重新连接后重试。
源码位置:modules/core/src/device/vivo/components/file_v2_transfer.rs:533
failed to decode reverse MASS packet: block 3 was not found!
报错原文
failed to decode reverse MASS packet: <底层错误>
# 或
failed to assemble reverse MASS payload: block N was not found!触发场景:拉取日志(或设备→App 方向的数据传输)时手表侧丢包,导致 MASS 分片重组失败。注意两条错误链独立存在:failed to decode reverse MASS packet 包裹的是底层包错误(如 Invalid reverse mass packet / Invalid crc32),block N was not found! 单独出现在分片缺块时,外层为 failed to assemble reverse MASS payload。
解决方案:原因不明,拉取之前先重启设备、清理手表内存会好一点。
源码位置:modules/core/src/device/xiaomi/components/mass.rs:251(decode context)、modules/core/src/device/xiaomi/packet/mass.rs:215(block not found)
Device connect timed out
报错原文
Device connect timed out触发场景:设备未在预期时间内完成连接握手(常见于设备处于其他配对模式、或蓝牙信号弱)。
解决方案:检查设备是否处于「连接新手机」/配对模式,确认蓝牙权限已授予,然后重试连接。
源码位置:frontapi/device.rs:532
Device connect canceled
报错原文
Device connect canceled触发场景:用户在连接过程中主动取消(例如切换页面、关闭连接弹窗)。
解决方案:重新点击连接,避免操作过程中切换页面。
源码位置:frontapi/device.rs:528
完整报错清单
一、Toast 弹窗报错
无可用设备
| 触发位置 | 消息 Key | 说明 |
|---|---|---|
logic/deviceConnectionGuard.ts | device.connect.noDevice | 当前无已连接设备时触发,多处调用(队列安装、音乐导入、传输诊断、日志获取等) |
logic/queue/installhelper.ts:262 | device.connect.noDevice | 安装任务创建时检测到无设备 |
logic/queue/musichelper.ts:120 | device.connect.noDevice | 音乐上传任务创建时检测到无设备 |
pages/settings/extratools.tsx | device.noDevice | 打开设备信息、开始/停止抓包、运行冒烟测试、获取日志时无设备 |
连接失败
| 触发位置 | 消息 | 说明 |
|---|---|---|
logic/device.ts:233 | device.connect.fail: ${message} 或 device.connect.fail | 连接设备失败(排除 iOS TargetRejected 情况) |
components/nav/NavDeviceCard.tsx:110 | device.wasm.missingAuth | WASM 运行时缺少 Authkey |
二、Rust 后端返回错误
蓝牙扫描
| 位置 | 错误消息 | 触发条件 |
|---|---|---|
frontapi/bluetooth.rs | ScanError::AdapterNotFound | 开始/停止扫描时未找到蓝牙适配器 |
设备连接核心
| 位置 | 错误消息 | 触发条件 |
|---|---|---|
frontapi/device.rs:493 | 蓝牙连接错误详情 | 设备连接时蓝牙层失败 |
frontapi/device.rs:520 | format_anyhow(&err) | 设备连接通用失败(含完整错误链) |
frontapi/device.rs:524 | Device connect failed | 设备连接失败 |
frontapi/device.rs:528 | Device connect canceled | 用户主动取消连接 |
frontapi/device.rs:532 | Device connect timed out | 设备连接超时 |
SPP 插件层连接错误
| 平台 | 错误消息 | 触发条件 |
|---|---|---|
btclassic-spp/macos | Connection closed | 连接关闭 |
btclassic-spp/macos | RFCOMM send already in progress | RFCOMM 发送冲突 |
btclassic-spp/macos | RFCOMM send timed out | RFCOMM 发送超时 |
btclassic-spp/macos | RFCOMM channel disconnected | RFCOMM 通道断开 |
btclassic-spp/win | Socket error: {code} | Socket 错误 |
btclassic-spp/win | Connection closed by peer | 对端关闭连接 |
btclassic-spp/win | Bluetooth is not available | 蓝牙不可用 |
btclassic-spp/win | No Bluetooth adapter found | 未找到蓝牙适配器 |
btclassic-spp/linux | Connection closed / BlueZ/DBus 错误 | Linux 蓝牙连接错误 |
btclassic-spp/desktop.rs | corelib::anyhow_site!(...) | 桌面端 SPP 错误转发 |
btclassic-spp/mobile.rs | Deserialize error from mobile: {e} | 移动端数据反序列化失败 |
btclassic-spp/mobile.rs | {err_msg} (Android msg.err) | SPP 读取错误 |
btclassic-spp/mobile.rs | Base64 decode error from mobile: {e} | Base64 解码失败 |
三、WASM / 逻辑层抛错
| 位置 | 错误消息 | 触发条件 |
|---|---|---|
ipc/wasmBridge.ts:9 | WASM bridge requested outside wasm runtime | 非 WASM 环境调用 WASM bridge |
ipc/wasmBridge.ts:170 | Unsupported command in wasm runtime: {command} | WASM 不支持该命令 |
四、队列内嵌报错(progressDesc)
连接相关错误被 taskList.ts 捕获后,以红色文字写入任务卡片的 progressDesc:
device.connect.noDevice— 常见于安装/音乐任务开始时检测到无设备连接
五、其他排查建议
| 报错 | 建议操作 |
|---|---|
device.connect.noDevice | 确保设备已连接,检查设备卡片状态 |
ScanError::AdapterNotFound | 检查设备蓝牙是否开启,桌面端检查蓝牙驱动/权限 |
RFCOMM channel disconnected (macOS) | 忽略设备后重新配对,或重启 AstroBox |
TargetRejected (iOS) | 前往系统设置-蓝牙中忽略对应设备后重试 |
device.wasm.missingAuth | WASM 模式下确保已填写 Authkey/OpenID |