jackwener/OpenCLI · error · CommandExecutionError
GeoGebra object existence probe returned malformed result
Error message
GeoGebra object existence probe returned malformed result
What it means
Thrown when the in-page probe returns something that is not a plain object — null/undefined, an array, or a non-object. The probe contract is a serialized envelope object ({ok,exists} or {error}); anything else means the evaluate bridge returned an unexpected value. This library throws it to fail fast rather than misread a corrupted result as 'object not found'.
Source
Thrown at clis/geogebra/info.js:42
try {
exists = unwrapBridgeEnvelope(await page.evaluate(`
(name => {
try {
if (typeof ggbApplet === 'undefined' || typeof ggbApplet.getObjectType !== 'function') {
return { error: 'ggbApplet is not ready' };
}
return { ok: true, exists: ggbApplet.getObjectType(name) !== '' };
} catch (err) {
return { error: err?.message || String(err) };
}
})
(${JSON.stringify(objName)})
`));
} catch (err) {
throw new CommandExecutionError(`Failed to inspect GeoGebra object: ${err?.message || err}`);
}
if (!exists || typeof exists !== 'object' || Array.isArray(exists)) {
throw new CommandExecutionError('GeoGebra object existence probe returned malformed result');
}
if (exists.error) {
throw new CommandExecutionError(`Failed to inspect GeoGebra object: ${exists.error}`);
}
if (exists.ok !== true || typeof exists.exists !== 'boolean') {
throw new CommandExecutionError('GeoGebra object existence probe returned malformed result');
}
if (exists.exists === false) {
throw new EmptyResultError(`geogebra info ${objName}`, `Object "${objName}" not found on the canvas.`);
}
const properties = ['type', 'value', 'definition', 'command', 'caption', 'visible', 'color'];
const rows = [];
for (const prop of properties) {
const val = await ggbGetProperty(page, objName, prop);
rows.push({ property: prop, value: String(val ?? '') });
}
View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run to rule out a transient bridge glitch
- Ensure the standard GeoGebra applet is loaded (let ensureApplet bind it) instead of a custom embed
- Check that no extension or wrapper alters page.evaluate return values
- Update the opencli/browser-driver stack so serialization matches the expected envelope
Defensive patterns
Strategy: type-guard
Type guard
function isProbeEnvelope(v) {
return v !== null && typeof v === 'object' && !Array.isArray(v);
}
// call: if (!isProbeEnvelope(result)) { /* malformed — do not trust */ } Try / catch
try {
await run('geogebra', 'info', '--name', 'A');
} catch (err) {
if (/malformed result/.test(err.message)) {
console.error('Bridge envelope malformed — check extensions/wrapper shims and re-run');
}
throw err;
} Prevention
- Run on a vanilla www.geogebra.org tab without userscripts/extensions that alter page results
- Keep opencli and its browser driver on matching versions
- Log raw evaluate output when debugging bridge protocol issues
When it happens
Trigger: `geogebra info` where the unwrapped bridge envelope is null, an array, or a scalar — typically because unwrapBridgeEnvelope received malformed serialized output from page.evaluate.
Common situations: Custom/older applet embeds whose postMessage bridge returns unexpected payloads; a wrapper shim intercepting evaluate results; driver versions that serialize results differently.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- `Failed to inspect GeoGebra object: ${err?.message || err}`
- `Failed to inspect GeoGebra object: ${exists.error}`
- Failed to detect GeoGebra applet: ${err?.message || err}
- Failed to load GeoGebra Geometry: ${err?.message || err}
- ggbApplet not available after waiting. Make sure the GeoGebr
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/e544f6a75f38957f.
Report an issue: GitHub.