GitHub Issue
[Bug]: Cannot access a chrome-extension:// URL of different extension
### Description
运行以下命令时报错
```
>opencli zhihu hot -f json
Error: attach failed: Cannot access a chrome-extension:// URL of different extension
```
```
opencli bilibili hot --limit 5
Error: attach failed: Cannot access a chrome-extension:// URL of different extension
```
现象:
新弹出了一个浏览器窗口(而不是打开一个新标签),可以访问目标网站。观察到账号为登录状态。
但是没有后续的操作,终端稍后报错。
环境:信息
操作系统:Win11
浏览器插件已安装
opencli版本:1.2.0
node版本:Node.js v22.16.0
chrome版本:Version 146.0.7680.154 (Official Build) (64-bit)
### Steps to Reproduce
1. Run `opencli zhihu hot -f json`
2. 浏览器成功弹出且成功访问目标网站,但没有进行后续操作
3. See error: Error: attach failed: Cannot access a chrome-extension:// URL of different extension
### Expected Behavior
正常返回网站结果
### OpenCLI Version
1.2.0
### Node.js Version
22.x
### Operating System
Windows
### Logs / Screenshots
```shell
> opencli zhihu hot -f json -v
[opencli] Starting daemon (js)...
[1/4] navigate → https://www.zhihu.com
→ (no data)
[2/4] evaluate → (async () => {
const res = await fetch('https://www.zhihu.com/api/v3/feed/t...
Error: attach failed: Cannot access a chrome-extension:// URL of different extension
at sendCommand (file:///C:/Users/xxxx/AppData/Roaming/npm/node_modules/@jackwener/opencli/dist/browser/daemon-client.js:66:23)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async stepEvaluate (file:///C:/Users/xxxx/AppData/Roaming/npm/node_modules/@jackwener/opencli/dist/pipeline/steps/browser.js:66:18)
at async executePipeli...
View Raw Thread
Developer & User Discourse
haoyueb2 • Mar 22, 2026
macos也有一样的错
Astro-Han • Mar 22, 2026
**根因分析**
当用户安装了"新标签页覆盖"类扩展(如 iTab、Momentum 等)时,Chrome 会把新窗口的 `about:blank` 替换为 `chrome-extension://` 页面。
问题出在 `extension/src/background.ts` 的 `resolveTabId()` 函数:
```ts
// L240-241
async function resolveTabId(tabId: number | undefined, workspace: string): Promise {
if (tabId !== undefined) return tabId; // ← 直接返回,跳过 isDebuggableUrl 检查
```
当 `tabId` 已存在(navigate 步骤返回后)时,直接 return,不经过后面的 `isDebuggableUrl` 校验:
```ts
// L246-249 — 仅在 tabId === undefined 时才走到这里
const tabs = await chrome.tabs.query({ windowId });
const debuggableTab = tabs.find(t => t.id && isDebuggableUrl(t.url));
if (debuggableTab?.id) return debuggableTab.id;
```
同时 `handleNavigate()` 返回前也未验证最终 URL 是否可调试:
```ts
// L320-321
const tab = await chrome.tabs.get(tabId);
return { id: cmd.id, ok: true, data: { title: tab.title, url: tab.url, tabId } };
// ← 没有检查 tab.url 是否为 chrome-extension://
```
因此后续 evaluate 步骤调用 `chrome.debugger.attach()` 时,目标 tab 仍为 `chrome-extension://` 页面,触发此错误。
**修复方向**:在 `resolveTabId...
当用户安装了"新标签页覆盖"类扩展(如 iTab、Momentum 等)时,Chrome 会把新窗口的 `about:blank` 替换为 `chrome-extension://` 页面。
问题出在 `extension/src/background.ts` 的 `resolveTabId()` 函数:
```ts
// L240-241
async function resolveTabId(tabId: number | undefined, workspace: string): Promise {
if (tabId !== undefined) return tabId; // ← 直接返回,跳过 isDebuggableUrl 检查
```
当 `tabId` 已存在(navigate 步骤返回后)时,直接 return,不经过后面的 `isDebuggableUrl` 校验:
```ts
// L246-249 — 仅在 tabId === undefined 时才走到这里
const tabs = await chrome.tabs.query({ windowId });
const debuggableTab = tabs.find(t => t.id && isDebuggableUrl(t.url));
if (debuggableTab?.id) return debuggableTab.id;
```
同时 `handleNavigate()` 返回前也未验证最终 URL 是否可调试:
```ts
// L320-321
const tab = await chrome.tabs.get(tabId);
return { id: cmd.id, ok: true, data: { title: tab.title, url: tab.url, tabId } };
// ← 没有检查 tab.url 是否为 chrome-extension://
```
因此后续 evaluate 步骤调用 `chrome.debugger.attach()` 时,目标 tab 仍为 `chrome-extension://` 页面,触发此错误。
**修复方向**:在 `resolveTabId...
jackwener • Mar 22, 2026
记得更新浏览器插件和版本
jackwener • Mar 22, 2026
原因是因为插件冲突了,你的浏览器插件里面有其他的
也会用到 Debbuger,类似于 youmind 这种,导致出现了问题
也会用到 Debbuger,类似于 youmind 这种,导致出现了问题
nevertoday • Mar 24, 2026
问题是插件太多了, 都不知道是那个干扰了。
Market Trends