jackwener/OpenCLI · error · CommandExecutionError
result.error || message
Error message
result.error || message
What it means
When the GeoGebra bridge result is a well-formed object but result.ok is false, requireGgbSuccess() throws CommandExecutionError carrying the bridge's own error text (result.error), or falls back to the caller's generic message if the bridge supplied none. This is the standard path for GeoGebra command-level failures, not bridge/transport failures.
Source
Thrown at clis/geogebra/utils.js:63
throw new ArgumentError(`${label} must be a ${positive ? 'positive ' : ''}finite number`);
}
return number;
}
export function normalizeCoords(value) {
const parts = String(value ?? '').split(',').map(s => s.trim());
if (parts.length !== 2) {
throw new ArgumentError('coords must be in "x,y" format (e.g. "1,2")');
}
return parts.map((part, idx) => normalizeNumber(part, idx === 0 ? 'x' : 'y'));
}
export function requireGgbSuccess(result, message) {
if (!isPlainObject(result)) {
throw new CommandExecutionError(`${message}: malformed GeoGebra result`);
}
if (!result.ok) {
throw new CommandExecutionError(result.error || message);
}
return result;
}
/**
* Navigate to GeoGebra Geometry (if not already there) and wait for
* the ggbApplet API to become available.
*/
export async function ensureApplet(page) {
let currentUrl = '';
try {
currentUrl = await page.getCurrentUrl();
} catch {
currentUrl = '';
}
// If already on the geometry page, check if applet is ready without re-navigating
if (currentUrl?.includes('geogebra.org/geometry')) {
try {View on GitHub (pinned to 49907e53dc)
Solutions
- Read the error detail (result.error) — it usually names the failing command or object.
- Validate the GeoGebra command syntax against GeoGebra docs; commands are case-sensitive.
- Ensure all referenced objects exist: run a listing of current objects or create prerequisites first.
- Retry with a corrected command; use error text to drive programmatic correction of auto-generated commands.
Example fix
// before await ggbEval(page, 'midpoint(A,B)'); // error: midpoint not found // after await ggbEval(page, 'Midpoint(A,B)');
Defensive patterns
Strategy: try-catch
Validate before calling
// validate GeoGebra command syntax / referenced objects before executing
if (/\bundefined\b/.test(cmd)) throw new Error('command contains unresolved placeholder'); Type guard
null
Try / catch
try { requireGgbSuccess(await ggbEval(page, cmd), 'Create point'); } catch (e) { console.error('GeoGebra rejected command:', e.message); /* fix cmd and retry */ } Prevention
- Match GeoGebra command capitalization exactly (Midpoint, not midpoint).
- Check referenced objects exist before commands that use them.
- Validate command names against current GeoGebra documentation.
- Keep result.error text in logs — it names the failing construct.
When it happens
Trigger: ggbApplet.evalCommandGetLabels rejected the command: invalid GeoGebra syntax ('A=(1,2' with unbalanced parens), undefined object references ('Reflect(B)' where B does not exist), or the command returned false because the object name collides with an existing object of a different type.
Common situations: Typos in GeoGebra command names (case-sensitive: 'Midpoint' not 'midpoint'), referencing objects deleted earlier in the session, localized command names not accepted, or generating commands programmatically with unfilled placeholders like 'undefined'.
Related errors
- Failed to detect GeoGebra applet: ${err?.message || err}
- ggbApplet not available after waiting. Make sure the GeoGebr
- Failed to execute GeoGebra command: ${err?.message || err}
- GeoGebra command returned malformed result
- Failed to read GeoGebra object property: ${err?.message || e
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/2bfa3c1217a9bbd8.
Report an issue: GitHub.