{"record":{"id":"fe92e0bca6b7c0fe","repo":"jackwener/OpenCLI","slug":"failed-to-inspect-geogebra-object-exists-error","errorCode":null,"errorMessage":"`Failed to inspect GeoGebra object: ${exists.error}`","messagePattern":"`Failed to inspect GeoGebra object: (.+?)`","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/geogebra/info.js","lineNumber":45,"sourceCode":"          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\n    // For point-like objects, also include coordinates\n    const objType = await ggbGetProperty(page, objName, 'type');\n    if (objType === 'point') {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/geogebra/info.js#L27-L63","documentation":"Thrown when the probe succeeded structurally but the in-page script reported an error in its envelope ({error: '...'}) — most commonly 'ggbApplet is not ready', or an exception thrown by ggbApplet.getObjectType inside the page. The library surfaces it as a CommandExecutionError prefixed with 'Failed to inspect GeoGebra object'.","triggerScenarios":"`geogebra info --name X` before the applet global (ggbApplet) exists or lacks getObjectType; or getObjectType throws for the given name (e.g. injection/serialization issue in the page context).","commonSituations":"Running info immediately after navigation before the applet finishes booting; using a GeoGebra page variant that names the API object differently; applet still loading on slow networks.","solutions":["Wait a moment and retry so the applet finishes initializing","Run a `geogebra eval` command first to force ensureApplet to wait for ggbApplet readiness","Verify the page is an official GeoGebra applet page (geometry/graphing) where the global is ggbApplet","Read the appended exists.error text — 'ggbApplet is not ready' means timing; other text points to the in-page cause"],"exampleFix":"// before\nopencli geogebra info --name A   # 'ggbApplet is not ready' right after navigate\n// after\nopencli geogebra eval --code '1+1'   # waits for applet\nopencli geogebra info --name A","handlingStrategy":"retry","validationCode":"// wait-for-applet pre-check before info\nawait run('geogebra', 'eval', '--code', '1+1'); // forces ensureApplet/ggbApplet readiness","typeGuard":null,"tryCatchPattern":"try {\n  await run('geogebra', 'info', '--name', 'A');\n} catch (err) {\n  if (/ggbApplet is not ready/.test(err.message)) {\n    await sleep(1500);\n    return retry(2);\n  }\n  throw err;\n}","preventionTips":["Always warm up the applet with an eval call before inspecting","Avoid running info in the same instant as navigation","Check the appended error text to distinguish timing vs structural issues"],"tags":["geogebra","applet-not-ready","browser","timing"],"backgroundTag":"applet-not-ready","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}