{"record":{"id":"c090265e0235e9ff","repo":"jackwener/OpenCLI","slug":"failed-to-read-geogebra-object-property-err-me","errorCode":null,"errorMessage":"Failed to read GeoGebra object property: ${err?.message || err}","messagePattern":"Failed to read GeoGebra object property: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/geogebra/utils.js","lineNumber":269,"sourceCode":"    return unwrapBridgeEnvelope(await page.evaluate(`\n      (objName, property) => {\n        const api = ggbApplet;\n        switch (property) {\n          case 'type': return api.getObjectType(objName);\n          case 'value': return api.getValueString(objName);\n          case 'color': return api.getColor(objName);\n          case 'visible': return api.getVisible(objName);\n          case 'caption': return api.getCaption(objName) || '';\n          case 'xcoord': return api.getXcoord(objName);\n          case 'ycoord': return api.getYcoord(objName);\n          case 'definition': return api.getDefinitionString(objName);\n          case 'command': return api.getCommandString(objName);\n          default: return null;\n        }\n      }\n    `, objName, property));\n  } catch (err) {\n    throw new CommandExecutionError(`Failed to read GeoGebra object property: ${err?.message || err}`);\n  }\n}\n","sourceCodeStart":251,"sourceCodeEnd":272,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/geogebra/utils.js#L251-L272","documentation":"ggbGetProperty in clis/geogebra/utils.js wraps every failure of the in-page GeoGebra bridge call (page.evaluate on the ggbApplet API) in a CommandExecutionError with this message. It means the browser-side call to one of the ggbApplet getters (getObjectType, getValueString, getXcoord, etc.) threw, or the bridge envelope failed to unwrap, so the property could not be read. The library throws it because the original browser exception is not serializable/meaningful on the Node side and gets normalized into a single CLI error.","triggerScenarios":"Calling ggbGetProperty (directly or via the result/val/objType/x/y commands) when: the object name does not exist in the applet so ggbApplet.getXcoord/etc throws; ggbApplet is undefined because the GeoGebra applet has not finished loading; the property name is unknown (switch default returns null, and unwrapBridgeEnvelope may fail); or the page/context crashed or navigated away during page.evaluate.","commonSituations":"Running a GeoGebra CLI command before the applet finished async initialization; a typo in the object label (GeoGebra labels are case-sensitive, e.g. 'a' vs 'A'); querying a property unsupported for the object type (e.g. xcoord of a text object or a list); the browser tab reloading or the evaluation script failing inside page.evaluate.","solutions":["Verify the object name exists first with a list-objects/objType command; GeoGebra labels are case-sensitive.","Wait for the applet to finish loading (or retry after a short delay) before reading properties.","Check that the requested property is valid for that object type (e.g. xcoord/ycoord only for points/curves).","Inspect the nested err.message in the message to distinguish a missing-object throw from a page/bridge failure.","If the page navigated or crashed, re-open the GeoGebra page and re-create/reload the applet before retrying."],"exampleFix":"// before — reading a coordinate possibly before object exists\nconst x = await ggbGetProperty(page, 'A', 'xcoord');\n// after — guard: wait for the object, then read\nawait waitForObjectCount(page, 1); // or check objType first\nif ((await ggbGetProperty(page, 'A', 'type')) === 'point') {\n  const x = await ggbGetProperty(page, 'A', 'xcoord');\n}","handlingStrategy":"try-catch","validationCode":"const type = await ggbGetProperty(page, objName, 'type').catch(() => null);\nif (type == null) throw new Error(`GeoGebra object '${objName}' not available yet`);","typeGuard":"function isReadResult(v) { return v !== undefined && v !== null; }","tryCatchPattern":"try {\n  const value = await ggbGetProperty(page, objName, property);\n} catch (err) {\n  if (/Failed to read GeoGebra object property/.test(err.message)) {\n    // retry after checking the object exists / applet is loaded\n  } else throw err;\n}","preventionTips":["Verify object names with a list/objType command before reading properties; labels are case-sensitive.","Wait for applet initialization before evaluating any ggbApplet calls.","Only request properties valid for the object's type (xcoord/ycoord for points, etc.).","Keep the browser page stable — avoid navigation during evaluation."],"tags":["geogebra","browser-automation","command-execution","object-property"],"backgroundTag":"browser-evaluation-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}