{"record":{"id":"00fc6d9b2eeae1f3","repo":"jackwener/OpenCLI","slug":"failed-to-inspect-geogebra-object-err-message","errorCode":null,"errorMessage":"`Failed to inspect GeoGebra object: ${err?.message || err}`","messagePattern":"`Failed to inspect GeoGebra object: (.+?)`","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/geogebra/info.js","lineNumber":39,"sourceCode":"    await ensureApplet(page);\n\n    let exists;\n    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);","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/geogebra/info.js#L21-L57","documentation":"This CommandExecutionError wraps any exception thrown by page.evaluate while running the in-page existence probe for `geogebra info`. It means the browser bridge call itself failed (page crashed, navigation tore down the execution context, the evaluate script threw outside the guarded inner try, or the bridge envelope could not be unwrapped), not that the object is absent. The original error message is appended for diagnosis.","triggerScenarios":"Calling `geogebra info --name A` when the tab navigated/closed mid-command, when page.evaluate rejects (execution context destroyed), or when the async evaluate result is a rejected promise the outer try/catch sees before unwrapping.","commonSituations":"Running the command against an already-bound tab that the user navigated away from www.geogebra.org; headless browser closed by timeout; applet iframe reload racing the probe.","solutions":["Re-run the command; transient navigation races usually resolve on retry","Re-bind the tab to www.geogebra.org (run a browser workspace bind/navigation command) before `geogebra info`","Run `geogebra eval` once to ensure the applet is loaded via ensureApplet, then retry info","Inspect the appended message for the underlying Playwright error and fix that root cause"],"exampleFix":"// before\nopencli geogebra info --name A   # fails after tab navigated\n// after\nopencli browser navigate https://www.geogebra.org/geometry && opencli geogebra eval --code 'ggbApplet.evalCommand(\"A=(1,2)\")' && opencli geogebra info --name A","handlingStrategy":"try-catch","validationCode":"// before running: ensure tab is still bound and on the applet page\nconst url = await page.url();\nif (!url.includes('geogebra.org')) throw new Error('Tab left geogebra.org; re-bind before geogebra info');","typeGuard":"function isEnvelope(v) { return v !== null && typeof v === 'object' && !Array.isArray(v); }","tryCatchPattern":"try {\n  await run('geogebra', 'info', '--name', 'A');\n} catch (err) {\n  if (/Failed to inspect GeoGebra object/.test(err.message)) {\n    await rebindTab('https://www.geogebra.org/geometry');\n    await run('geogebra', 'eval', '--code', '1+1'); // re-init applet\n    return retry();\n  }\n  throw err;\n}","preventionTips":["Keep the bound tab open and un-navigated for the duration of the command","Run a cheap `geogebra eval` first so ensureApplet has initialized the applet","Wrap info calls in a retry with rebind-once semantics","Treat any 'Failed to inspect' as an infrastructure issue, not a data issue"],"tags":["browser","playwright","geogebra","bridge"],"backgroundTag":"browser-bridge-evaluate-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}