{"record":{"id":"e544f6a75f38957f","repo":"jackwener/OpenCLI","slug":"geogebra-object-existence-probe-returned-malformed","errorCode":null,"errorMessage":"GeoGebra object existence probe returned malformed result","messagePattern":"GeoGebra object existence probe returned malformed result","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/geogebra/info.js","lineNumber":42,"sourceCode":"    try {\n      exists = unwrapBridgeEnvelope(await page.evaluate(`\n        (name => {\n          try {\n            if (typeof ggbApplet === 'undefined' || typeof ggbApplet.getObjectType !== 'function') {\n              return { error: 'ggbApplet is not ready' };\n            }\n            return { ok: true, exists: ggbApplet.getObjectType(name) !== '' };\n          } catch (err) {\n            return { error: err?.message || String(err) };\n          }\n        })\n        (${JSON.stringify(objName)})\n      `));\n    } catch (err) {\n      throw new CommandExecutionError(`Failed to inspect GeoGebra object: ${err?.message || err}`);\n    }\n    if (!exists || typeof exists !== 'object' || Array.isArray(exists)) {\n      throw new CommandExecutionError('GeoGebra object existence probe returned malformed result');\n    }\n    if (exists.error) {\n      throw new CommandExecutionError(`Failed to inspect GeoGebra object: ${exists.error}`);\n    }\n    if (exists.ok !== true || typeof exists.exists !== 'boolean') {\n      throw new CommandExecutionError('GeoGebra object existence probe returned malformed result');\n    }\n    if (exists.exists === false) {\n      throw new EmptyResultError(`geogebra info ${objName}`, `Object \"${objName}\" not found on the canvas.`);\n    }\n\n    const properties = ['type', 'value', 'definition', 'command', 'caption', 'visible', 'color'];\n    const rows = [];\n    for (const prop of properties) {\n      const val = await ggbGetProperty(page, objName, prop);\n      rows.push({ property: prop, value: String(val ?? '') });\n    }\n","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/geogebra/info.js#L24-L60","documentation":"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'.","triggerScenarios":"`geogebra info` where the unwrapped bridge envelope is null, an array, or a scalar — typically because unwrapBridgeEnvelope received malformed serialized output from page.evaluate.","commonSituations":"Custom/older applet embeds whose postMessage bridge returns unexpected payloads; a wrapper shim intercepting evaluate results; driver versions that serialize results differently.","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"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function isProbeEnvelope(v) {\n  return v !== null && typeof v === 'object' && !Array.isArray(v);\n}\n// call: if (!isProbeEnvelope(result)) { /* malformed — do not trust */ }","tryCatchPattern":"try {\n  await run('geogebra', 'info', '--name', 'A');\n} catch (err) {\n  if (/malformed result/.test(err.message)) {\n    console.error('Bridge envelope malformed — check extensions/wrapper shims and re-run');\n  }\n  throw err;\n}","preventionTips":["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"],"tags":["browser","geogebra","serialization","bridge"],"backgroundTag":"bridge-envelope-malformed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}