jackwener/OpenCLI · warning · ArgumentError
${label} must be an ASCII GeoGebra label like A, B1, or poly
Error message
${label} must be an ASCII GeoGebra label like A, B1, or poly_1 What it means
An ArgumentError from normalizeLabel: a GeoGebra label must match /^[A-Za-z][A-Za-z0-9_]*$/ — start with a letter, then letters/digits/underscores only. The `label` parameter names which argument failed (e.g. 'name', 'label[1]', 'points[2]'), so you can tell which value in a list was bad.
Source
Thrown at clis/geogebra/utils.js:28
const GEOGEBRA_URL = 'https://www.geogebra.org/geometry';
const APPLET_WAIT_MS = 15_000;
export function unwrapBridgeEnvelope(value) {
if (value && typeof value === 'object' && 'data' in value && 'session' in value) {
return value.data;
}
return value;
}
function isPlainObject(value) {
return value && typeof value === 'object' && !Array.isArray(value);
}
export function normalizeLabel(value, label = 'label') {
const normalized = String(value ?? '').trim();
if (!/^[A-Za-z][A-Za-z0-9_]*$/.test(normalized)) {
throw new ArgumentError(`${label} must be an ASCII GeoGebra label like A, B1, or poly_1`);
}
return normalized;
}
export function normalizeLabelList(value, label, min, max = Infinity) {
const parts = String(value ?? '').split(',').map(s => s.trim()).filter(Boolean);
if (parts.length < min || parts.length > max) {
throw new ArgumentError(`${label} must contain ${min === max ? min : `${min}-${max}`} comma-separated labels`);
}
return parts.map((part, idx) => normalizeLabel(part, `${label}[${idx + 1}]`));
}
export function normalizeNumber(value, label, { defaultValue, positive = false } = {}) {
const raw = value == null || value === '' ? defaultValue : value;
const number = Number(raw);
if (!Number.isFinite(number) || (positive && number <= 0)) {
throw new ArgumentError(`${label} must be a ${positive ? 'positive ' : ''}finite number`);
}View on GitHub (pinned to 49907e53dc)
Solutions
- Use a valid label: letter first, then letters/digits/underscores (A, B1, poly_1)
- Trim whitespace and surrounding quotes from the value
- Rename the object in GeoGebra to a compliant label (e.g. Rename command) and re-run
- For lists, fix the specific element indicated by label[N] in the message
Example fix
// before opencli geogebra info --name "1A" // after opencli geogebra info --name "A1"
Defensive patterns
Strategy: validation
Validate before calling
const LABEL_RE = /^[A-Za-z][A-Za-z0-9_]*$/;
if (!LABEL_RE.test(String(name ?? '').trim())) {
throw new Error(`Label "${name}" invalid: must start with a letter, then letters/digits/underscores`);
} Type guard
const isValidGgbLabel = (v) => /^[A-Za-z][A-Za-z0-9_]*$/.test(String(v ?? '').trim());
Try / catch
try {
await run('geogebra', 'info', '--name', label);
} catch (err) {
if (/must be an ASCII GeoGebra label/.test(err.message)) {
label = sanitizeLabel(label); // trim quotes/space, fix leading digit
return run('geogebra', 'info', '--name', label);
}
throw err;
} Prevention
- Sanitize labels: trim, strip quotes, ensure letter-first
- Use letters, digits, and underscores only — no hyphens or spaces
- Check list output for the exact canonical label before passing it
When it happens
Trigger: `geogebra info --name '1A'` (starts with digit), `--name 'my point'` (space), `--name 'A-B'` (hyphen), `--name ''` (empty); also any point/circle helper that calls normalizeLabel with a bad element of a comma list.
Common situations: Copying labels with trailing whitespace or quotes; using hyphens from CSS-style naming; numeric-first labels; passing property keys instead of GeoGebra labels.
Related errors
- ${label} must contain ${min === max ? min : `${min}-${max}`}
- Use either --point or --radius, not both
- Provide --radius (number or point label) or --point (point o
- type must be one of: line, segment, ray
- command must contain at least one GeoGebra command
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/5752a08b94f97394.
Report an issue: GitHub.