jackwener/OpenCLI · warning · EmptyResultError

`geogebra info ${objName}`, `Object "${objName}" not found o

Error message

`geogebra info ${objName}`, `Object "${objName}" not found on the canvas.`

What it means

An EmptyResultError (not a failure): the existence probe ran successfully and reported that no GeoGebra object with the given label exists on the canvas. The command's context string is `geogebra info <name>` and the human message names the missing object. This is the library's way of returning 'not found' as a distinct, catchable outcome.

Source

Thrown at clis/geogebra/info.js:51

            return { error: err?.message || String(err) };
          }
        })
        (${JSON.stringify(objName)})
      `));
    } catch (err) {
      throw new CommandExecutionError(`Failed to inspect GeoGebra object: ${err?.message || err}`);
    }
    if (!exists || typeof exists !== 'object' || Array.isArray(exists)) {
      throw new CommandExecutionError('GeoGebra object existence probe returned malformed result');
    }
    if (exists.error) {
      throw new CommandExecutionError(`Failed to inspect GeoGebra object: ${exists.error}`);
    }
    if (exists.ok !== true || typeof exists.exists !== 'boolean') {
      throw new CommandExecutionError('GeoGebra object existence probe returned malformed result');
    }
    if (exists.exists === false) {
      throw new EmptyResultError(`geogebra info ${objName}`, `Object "${objName}" not found on the canvas.`);
    }

    const properties = ['type', 'value', 'definition', 'command', 'caption', 'visible', 'color'];
    const rows = [];
    for (const prop of properties) {
      const val = await ggbGetProperty(page, objName, prop);
      rows.push({ property: prop, value: String(val ?? '') });
    }

    // For point-like objects, also include coordinates
    const objType = await ggbGetProperty(page, objName, 'type');
    if (objType === 'point') {
      const x = await ggbGetProperty(page, objName, 'xcoord');
      const y = await ggbGetProperty(page, objName, 'ycoord');
      rows.push({ property: 'x', value: String(x ?? '') });
      rows.push({ property: 'y', value: String(y ?? '') });
    }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Create the object first, e.g. opencli geogebra eval --code 'B=(2,3)', then run info
  2. Verify the exact label with `geogebra list` and match case (GeoGebra labels are case-sensitive)
  3. Re-create the object if the session restarted — fresh runs start blank
  4. Ensure the bound tab is the one containing your construction

Example fix

// before
opencli geogebra info --name B   # B does not exist
// after
opencli geogebra eval --code 'B=(2,3)'
opencli geogebra info --name B
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check existence via list
const out = await run('geogebra', 'list');
if (!out.split('\n').some(l => l.startsWith('A,'))) {
  throw new Error('Object A not on canvas — create it first');
}

Try / catch

try {
  return await run('geogebra', 'info', '--name', 'A');
} catch (err) {
  if (/not found on the canvas/.test(err.message)) {
    await run('geogebra', 'eval', '--code', 'A=(1,2)');
    return run('geogebra', 'info', '--name', 'A');
  }
  throw err;
}

Prevention

When it happens

Trigger: `geogebra info --name B` when B was never created, was deleted (Delete/B command), the wrong session/tab is bound, or the label is case-mismatched (b vs B).

Common situations: Querying an object before running the eval that creates it; a fresh blank session on a new run (no persistence between runs); typo in the label; object removed by a ResetConstruction.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/d6165f00f0f9f4c1. Report an issue: GitHub.