musistudio/claude-code-router · error · Error
browser_chrome_login_import requires domains or an active ht
Error message
browser_chrome_login_import requires domains or an active http(s) tab.
What it means
Thrown by the domain-resolution helper for browser_chrome_login_import when the caller supplies no domains argument and the fallback — deriving a domain from the specified tab or the active tab's URL — cannot yield an http(s) domain. The import needs at least one target domain, either explicit or inferred from a web page.
Source
Thrown at packages/electron/src/main/browser-automation-mcp.ts:1463
windowId: builtInBrowserService.getAutomationWindowId()
};
}
function resolveChromeLoginImportDomains(args: Record<string, unknown>, fallbackTabId?: string): string[] {
const explicit = uniqueStrings([
...readStringArray(args.domains),
...(readString(args.domain) ? [readString(args.domain) as string] : [])
].map(normalizeChromeLoginImportDomain).filter((domain): domain is string => Boolean(domain)));
if (explicit.length > 0) {
return explicit;
}
const state = builtInBrowserService.getAutomationState();
const tabId = readString(args.tabId) || fallbackTabId || state.activeTabId;
const tab = state.tabs.find((candidate) => candidate.id === tabId) || state.tabs.find((candidate) => candidate.id === state.activeTabId);
const domain = normalizeChromeLoginImportDomain(tab?.url);
if (!domain) {
throw new Error("browser_chrome_login_import requires domains or an active http(s) tab.");
}
return [domain];
}
function normalizeChromeLoginImportDomain(value: unknown): string | undefined {
const raw = readString(value)?.toLowerCase();
if (!raw) {
return undefined;
}
try {
const url = new URL(raw.includes("://") ? raw : `https://${raw}`);
return url.hostname.replace(/^\*\./, "").replace(/^\./, "");
} catch {
const domain = raw.replace(/^\*\./, "").replace(/^\./, "").split("/")[0];
return domain && !domain.includes(" ") ? domain : undefined;
}
}
View on GitHub (pinned to 99f24806c6)
Solutions
- Pass an explicit domains array, e.g. { domains: ["example.com"] }.
- Or navigate a tab to the target site first so the active tab's URL yields a domain.
- Ensure domains values are plain hostname strings (scheme/path stripped) as the helper expects.
Example fix
// before
await call("browser_chrome_login_import", {}); // active tab is about:blank
// after
await call("browser_chrome_login_import", { domains: ["example.com"] }); Defensive patterns
Strategy: validation
Validate before calling
const domains = args.domains?.length ? args.domains : inferActiveHttpDomain(await call("browser_tab_list", {}));
if (!domains?.length) throw new Error("No domains available — navigate to the target site first");
await call("browser_chrome_login_import", { ...args, domains }); Type guard
function hasDomains(a: unknown): a is { domains: string[] } { return Array.isArray((a as any)?.domains) && (a as any).domains.length > 0; } Try / catch
try { await call("browser_chrome_login_import", args); } catch (e) { if (e instanceof Error && e.message.includes("requires domains or an active http(s) tab")) { await call("browser_chrome_login_import", { ...args, domains: ["example.com"] }); } else throw e; } Prevention
- Always pass explicit domains
- Navigate to the target site before importing
- Strip scheme/path from domain strings
When it happens
Trigger: Calling browser_chrome_login_import with neither args.domains nor args.tabId while the active tab is blank, on a chrome:// page, or has no http(s) URL (normalizeChromeLoginImportDomain returns undefined).
Common situations: Running the import right after opening the browser with no page loaded; the active tab is the default new-tab page; passing domains in the wrong shape so they read as empty.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- browser_tab_activate requires tabId or session.
- browser_tab_close requires tabId or session.
- Chrome login import job was not found: ${jobId}
- A valid browser automation session is required.
- browser_navigate could not resolve an active tab.
AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27).
Data as JSON: /api/errors/63abd5f588c26deb.
Report an issue: GitHub.