garrytan/gstack · error · Error
Cannot parse params as JSON: ${e.message} Cause: argument '$
Error message
Cannot parse params as JSON: ${e.message}
Cause: argument '${args[1]}' is not valid JSON.
Action: pass a JSON object literal, e.g. '{"backendNodeId":42}'. What it means
Error "Cannot parse params as JSON: ${e.message} Cause: argument '${args[1]}' is not valid JSON. Action: pass a JSON object literal, e.g. '{"backendNodeId":42}'." thrown in garrytan/gstack.
Source
Thrown at browse/src/cdp-commands.ts:49
'Usage: $B cdp <Domain.method> [json-params]',
'',
'Allowed methods are listed in browse/src/cdp-allowlist.ts. To add one,',
'open a PR with a one-line justification and the (scope, output) tags.',
'Examples:',
' $B cdp Accessibility.getFullAXTree {}',
' $B cdp Performance.getMetrics {}',
' $B cdp DOM.describeNode \'{"backendNodeId":42,"depth":3}\'',
].join('\n');
}
const qualified = args[0]!;
const { domain, method } = parseQualified(qualified);
// Optional second arg is JSON params; default to {}.
let params: Record<string, unknown> = {};
if (args[1]) {
try {
params = JSON.parse(args[1]) ?? {};
} catch (e: any) {
throw new Error(
`Cannot parse params as JSON: ${e.message}\n` +
`Cause: argument '${args[1]}' is not valid JSON.\n` +
'Action: pass a JSON object literal, e.g. \'{"backendNodeId":42}\'.'
);
}
}
// Dispatch via the bridge (allowlist + mutex + timeout + finally-release).
const tabId = bm.getActiveTabId();
const { raw, entry } = await dispatchCdpCall({ domain, method, params, tabId, bm });
const json = JSON.stringify(raw, null, 2);
if (entry.output === 'untrusted') {
return wrapUntrustedContent(json, `cdp:${qualified}`);
}
return json;
}
View on GitHub (pinned to 94993f7401)
When it happens
Trigger: Thrown at browse/src/cdp-commands.ts:49 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of garrytan/gstack@94993f7401 (2026-08-12).
Data as JSON: /api/errors/e53d68bb5ca2abe9.
Report an issue: GitHub.