Skip to content

[Bug] HarmonyOS PC (2in1): Skin Market fails with "decode base64 secret from ArkTS response: Invalid symbol 123, offset 0" — ArkTS response is JSON where base64 payload is expected #2885

Description

@rovskin

Summary

Opening the Skin/Appearance Market on the HarmonyOS PC build fails immediately with a base64 decode error. Evidence below indicates the engine received a JSON payload (first byte { = 123) from the ArkTS layer where a base64-encoded secret/payload was expected, and the decoder has no type/error check before decoding.

Environment

Item Value
Device HarmonyOS PC (2in1)
App version BitFun v1.0.1 (versionCode 1000001), bundleName com.develop.opensource.ohpcd.bitfun, debug build
Build source Community HarmonyOS build (gitcode OpenHarmonyPCDeveloper/BitFun, tag v0.2.7 era, built 2026-06-18)
hap SHA256 4063cd0371cfb84f5a1970cebb36f053300d76685147ee46383822e00e8b1c05
Date observed 2026-09-08

Note: official GitHub releases (checked through v1.0.0-beta.3, 2026-09-07) do not ship a HarmonyOS hap, so this community build is currently the only packaged option. The root cause may be protocol drift between this June build and the current market backend.

Steps to reproduce

  1. Open BitFun (HarmonyOS PC build)
  2. Go to Settings → Appearance (Skin)
  3. Open the Skin Market
  4. The error appears instead of the market listing (reproduced consistently on 2026-09-08)

Actual behavior

decode base64 secret from ArkTS response: Invalid symbol 123, offset 0.

Expected behavior

  • The market listing loads normally; or
  • If the backend responds with an error (non-200 or a JSON error body), the client surfaces a readable message (HTTP status / server error field) instead of failing inside a base64 decode.

Diagnosis (from unpacking the hap)

  • Invalid symbol {byte}, offset {index} is the standard DecodeError display of the Rust base64 crate. The format template (Invalid symbol , offset ., alongside Invalid last symbol, Invalid padding, Invalid input length:) is present in libs/arm64-v8a/libbitfun_desktop_lib.so.
  • Invalid symbol 123, offset 0 means the first byte of the decoder input was 0x7B ({) — i.e. the input was JSON, not base64.
  • The prefix decode base64 secret from ArkTS response indicates the input comes from an ArkTS-layer response consumed by the engine.
  • Likely chain: engine asks the ArkTS shell for the encrypted/base64 market payload → ArkTS returns a JSON body (server error / protocol mismatch / gateway interception) → the engine decodes it as base64 without checking success/type first and fails with a cryptic message.

Suggested fix direction

  • Engine/frontend: before base64-decoding an ArkTS response, detect JSON / non-success responses and propagate a readable error (HTTP status, server error message) instead of the raw decode failure.
  • ArkTS shell: return a structured error for non-success responses rather than passing the raw body through as if it were the payload.

Notes

  • Searched existing issues (15 hits for "base64"); no prior report of this error found. Apologies if duplicated.
  • I can collect hilog captures from the ArkTS side if useful.

标题:[Bug] 鸿蒙 PC(2in1):皮肤市场报错 "decode base64 secret from ArkTS response: Invalid symbol 123, offset 0"——ArkTS 返回的是 JSON,而引擎期望 base64 载荷

摘要:鸿蒙 PC 版打开皮肤市场立即报 base64 解码错误。证据表明引擎从 ArkTS 层收到的是 JSON(首字节 {=123),而期望的是 base64 密文,解码前无类型/错误检查。

环境:鸿蒙 PC(2in1);BitFun v1.0.1(第三方 gitcode 构建,2026-06-18,v0.2.7 时代代码,debug 包);官方 release 截至 1.0.0-beta.3 均无鸿蒙 hap。2026-09-08 稳定复现。

诊断:so 里有 Rust base64 crate 的报错模板;Invalid symbol 123, offset 0 = 解码输入首字节是 {,即 JSON;消息前缀表明输入来自 ArkTS 响应。推测链路:引擎向 ArkTS 壳要市场加密载荷 → ArkTS 返回 JSON(服务端错误/协议不代/网关拦截)→ 引擎未判类型直接 base64 解码失败。

修复建议:引擎侧解码前检测 JSON/错误响应并透出可读错误(HTTP 状态/服务端错误字段);ArkTS 侧对非成功响应返回结构化错误而非透传响应体。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions