{"record":{"id":"d025e6210b661265","repo":"jackwener/OpenCLI","slug":"type-must-be-one-of-line-segment-ray","errorCode":null,"errorMessage":"type must be one of: line, segment, ray","messagePattern":"type must be one of: line, segment, ray","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/geogebra/add-line.js","lineNumber":29,"sourceCode":"  strategy: Strategy.PUBLIC,\n  browser: true,\n  navigateBefore: false,\n  example: 'opencli geogebra add-line --points A,B --type segment',\n  args: [\n    { name: 'points', required: true, help: 'Two point labels separated by comma (e.g. \"A,B\")' },\n    { name: 'type', required: false, choices: ['line', 'segment', 'ray'], default: 'line', help: 'Type: line, segment, or ray (default: line)' },\n  ],\n  columns: ['label', 'type', 'points'],\n  func: async (page, kwargs) => {\n    const [a, b] = normalizeLabelList(kwargs.points, 'points', 2, 2);\n    const type = kwargs.type || 'line';\n    const geogebraCmd = {\n      line: `Line(${a},${b})`,\n      segment: `Segment(${a},${b})`,\n      ray: `Ray(${a},${b})`,\n    }[type];\n    if (!geogebraCmd) {\n      throw new ArgumentError('type must be one of: line, segment, ray');\n    }\n    await ensureApplet(page);\n    const result = requireGgbSuccess(await ggbEval(page, geogebraCmd), `Failed to create ${type}: ${geogebraCmd}`);\n    return [{ label: result.label, type, points: `${a},${b}` }];\n  },\n});\n","sourceCodeStart":11,"sourceCodeEnd":36,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/geogebra/add-line.js#L11-L36","documentation":"ArgumentError thrown by geogebra add-line when the --type value does not map to a supported GeoGebra command. Only line, segment, and ray are accepted; any other string yields no command and triggers this error.","triggerScenarios":"Passing --type with a misspelled, capitalized, or unsupported value (e.g. 'Line', 'vector', 'lin') at clis/geogebra/add-line.js:29.","commonSituations":"Case-sensitivity mistakes; assuming other GeoGebra object types are supported; typos in scripts.","solutions":["Use exactly one of: line, segment, ray (lowercase)","Correct the typo/casing in the script or command"],"exampleFix":"// before\nopencli geogebra add-line --a A --b B --type Line\n// after\nopencli geogebra add-line --a A --b B --type line","handlingStrategy":"validation","validationCode":"const VALID = new Set(['line','segment','ray']);\nconst t = String(args.type ?? '').trim().toLowerCase();\nif (!VALID.has(t)) {\n  throw new Error(`type must be one of: line, segment, ray (got '${args.type}')`);\n}","typeGuard":"function isLineType(v: unknown): v is 'line' | 'segment' | 'ray' {\n  return v === 'line' || v === 'segment' || v === 'ray';\n}","tryCatchPattern":null,"preventionTips":["Remember values are lowercase and exact","Whitelist the three accepted values in calling scripts","Map synonyms (e.g. 'Line'/'straight') to 'line' before invoking"],"tags":["cli","argument-validation","geogebra"],"backgroundTag":"invalid-enum-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}