Description
When a JavaScript expression fails during CLI vibium eval or MCP browser_evaluate, Vibium reports a generic error with no useful detail:
Error: failed to evaluate: script exception:
The browser does throw a real exception (e.g. SecurityError, ReferenceError), but Vibium fails to read it from the WebDriver BiDi response and surfaces an empty message instead.
Steps to Reproduce
-
Run a script that throws on the default page (about:blank - lazy launch):
vibium eval "localStorage.setItem('key', 'value')"
Or navigate first and throw a reference error:
vibium go "https://example.com"
vibium eval "undefinedVariable"
Expected Behavior
The CLI should show the actual JavaScript exception message, for example:
Error: failed to evaluate: script exception: SecurityError: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
or:
Error: failed to evaluate: script exception: ReferenceError: undefinedVariable is not defined
Actual Behavior
Error: failed to evaluate: script exception:
The message after script exception: is always empty, making debugging impossible.
Root Cause
CLI and MCP evaluation go through browser_evaluate → h.client.Evaluate() in clicker/internal/bidi/script.go.
When a script throws, the WebDriver BiDi spec returns type: "exception" with details in exceptionDetails (including text, lineNumber, stackTrace), not in result:
{
"type": "exception",
"exceptionDetails": {
"text": "SecurityError: Failed to read the 'localStorage' property...",
"lineNumber": 1,
"columnNumber": 1
}
}
Vibium only parses type and result, and builds the error from the wrong field:
// clicker/internal/bidi/script.go
if evalResult.Type == "exception" {
return nil, fmt.Errorf("script exception: %s", string(evalResult.Result))
}
evalResult.Result is empty for exception responses, so the error message is blank.
Impacted Operations
- CLI:
vibium eval
- MCP:
browser_evaluate
- Any daemon/MCP handler that uses
bidi.Client.Evaluate() or bidi.Client.CallFunction() in clicker/internal/bidi/script.go
Proposed Fix
In clicker/internal/bidi/script.go, parse exceptionDetails when type == "exception" and use exceptionDetails.text (and optionally line/stack) in the error message. Apply the same fix to both Evaluate() and CallFunction().
Description
When a JavaScript expression fails during CLI
vibium evalor MCPbrowser_evaluate, Vibium reports a generic error with no useful detail:The browser does throw a real exception (e.g.
SecurityError,ReferenceError), but Vibium fails to read it from the WebDriver BiDi response and surfaces an empty message instead.Steps to Reproduce
Run a script that throws on the default page (
about:blank- lazy launch):Or navigate first and throw a reference error:
Expected Behavior
The CLI should show the actual JavaScript exception message, for example:
or:
Actual Behavior
The message after
script exception:is always empty, making debugging impossible.Root Cause
CLI and MCP evaluation go through
browser_evaluate→h.client.Evaluate()inclicker/internal/bidi/script.go.When a script throws, the WebDriver BiDi spec returns
type: "exception"with details inexceptionDetails(includingtext,lineNumber,stackTrace), not inresult:{ "type": "exception", "exceptionDetails": { "text": "SecurityError: Failed to read the 'localStorage' property...", "lineNumber": 1, "columnNumber": 1 } }Vibium only parses
typeandresult, and builds the error from the wrong field:evalResult.Resultis empty for exception responses, so the error message is blank.Impacted Operations
vibium evalbrowser_evaluatebidi.Client.Evaluate()orbidi.Client.CallFunction()inclicker/internal/bidi/script.goProposed Fix
In
clicker/internal/bidi/script.go, parseexceptionDetailswhentype == "exception"and useexceptionDetails.text(and optionally line/stack) in the error message. Apply the same fix to bothEvaluate()andCallFunction().