Skip to content

[Bug] 安装插件报 unrecognized_keys:claude-plugins-official 市场 code-modernization 的 userConfig 含 options 字段被严格校验拒绝,整个市场无法安装 #1258

Open

Description

@pactera-baoxin

问题类别 · Category

其他 / 插件市场 · Other / Plugin marketplace

涉及的 Agent 框架 · Agent framework

ZCode Agent(自研)

严重程度 · Severity

阻塞使用 · Blocking(claude-plugins-official 市场的所有插件均无法安装;已提交前搜索现有 issue,确认无重复)

复现频率 · Reproducibility

必现 · Always(安装流程会校验整个市场清单,失败项在共享清单深处,任何安装都会命中)

问题描述 · Description

从 claude-plugins-official 市场(GitHub: anthropics/claude-plugins-official,315 个插件)安装任意插件时,安装被 zod 严格校验错误阻断:

[
  { "code": "unrecognized_keys", "keys": ["options"], "path": ["plugins", 20, "userConfig", "track"], "message": "Unrecognized key: \"options\"" },
  { "code": "unrecognized_keys", "keys": ["options"], "path": ["plugins", 20, "userConfig", "panel"], "message": "Unrecognized key: \"options\"" }
]

根因已定位:该市场中 Anthropic 官方插件 code-modernization 的 plugin.json,其 userConfig.track 与 userConfig.panel 两个配置项带有 options 字段(枚举取值提示,如 ["auto","transform","uplift","reimagine"])。ZCode 当前 userConfig schema 只接受 type / title / description / default / required / sensitive 六个字段(与官方文档一致),strict 校验遇到未知键直接拒绝整个清单,导致该市场所有插件都无法安装——包括与 code-modernization 无关的插件。

指纹唯一性:全机所有清单中,userConfig.track + userConfig.panel 同时带 options 的只有这一个插件,与报错两条记录完全吻合。

细节佐证:报错路径是 plugins[20],但该插件在本地清单和上游 GitHub 清单中均位于 plugins[72](总 315 项)——说明校验对象是 ZCode 内部重排后的插件数组,而非市场清单原文;这不影响定性,仅供定位校验代码时参考。

已在本地验证:手工剥离这两个 options 键后(marketplace 副本 + cache 副本),该字段 ZCode 界面本就不渲染,剥离无功能损失——可作为临时 workaround,但市场重新拉取/更新后会被上游清单覆盖复原。

复现步骤 · Steps to reproduce

  1. ZCode 3.16.3 桌面版 → Settings → Plugin Management → Discover,已添加 claude-plugins-official 市场(来源 anthropics/claude-plugins-official)
  2. 点击该市场任意插件的「获取 / Get」安装
  3. 安装失败,返回上述两条 unrecognized_keys 校验错误

期望表现 · Expected behavior

满足以下任一即可:

  1. strip 未知键:userConfig 条目校验时忽略未识别字段(zod .strip() / 非 strict object),仅对已知字段生效——与 plugin.json 顶层对 channels / lspServers / outputStyles / settings 的「仅登记不执行」宽松策略保持一致;
  2. 支持 options 字段:作为 string 类型的枚举提示,界面渲染为下拉选择;
  3. 至少降级为警告(诊断提示),不阻断整个市场的安装。

实际表现 · Actual behavior

claude-plugins-official 市场内任何插件点击安装即报 unrecognized_keys 错误,安装无法完成。该市场来自 Anthropic 官方,其清单是 Claude Code 插件方言下的合法内容,预计会长期存在此类字段。

ZCode 版本 · ZCode version

3.16.3(最新版,2026-10-23 发布;更新日志中无相关 schema 变更,升级无法解决)

设备 / 系统 · Device / OS

macOS 桌面版(Apple Silicon, arm64)

截图 / 日志 · Screenshots / Logs

无截图;关键证据均为文件与报错原文:

报错清单中 code-modernization 的涉事字段(plugins/<市场>/plugins/code-modernization/.claude-plugin/plugin.json):

"track": {
  "type": "string",
  "title": "Track to follow",
  "default": "auto",
  "options": ["auto", "transform", "uplift", "reimagine"]
},
"panel": {
  "type": "string",
  "title": "Progress pane",
  "default": "auto",
  "options": ["auto", "command", "off"]
}

修复建议

建议与 #1029、#1166 一并排查——三者同属「上游/协议内容含新增字段 → strict schema 整体拒绝」一类问题。对第三方市场清单(尤其 Claude Code 方言)采用宽松校验 + 未知键 strip,能避免单个插件的未知字段放大为整个市场不可用。

Activity

  1. github-actions commented on Oct 27, 2026

    @github-actions

    👋 感谢你的反馈,我们已经收到。

    • 维护者看到后会尽快回复你。
    • 状态保持为 status: 待评估,你可以随时补充信息。
    • 信息不全时我们会打上 needs: 更多信息 标签并 @ 你。

    👋 Thanks — we've received your issue.

    • A maintainer will get back to you as soon as we can.
    • Status stays at status: 待评估 (Triage); feel free to add context.
    • If we need more details, we'll add needs: 更多信息 and ping you.
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions