{"record":{"id":"bf113b2d86077d8e","repo":"jackwener/OpenCLI","slug":"picker-option-rawlabel-is-ambiguous","errorCode":null,"errorMessage":"Picker option \"${rawLabel}\" is ambiguous.","messagePattern":"Picker option \"(.+?)\" is ambiguous\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/codex/send.js","lineNumber":24,"sourceCode":"const PICKER_ITEM_SELECTOR = '[data-list-navigation-item=\"true\"]';\n\nexport function findUniquePickerOption(options, rawLabel) {\n    const wanted = String(rawLabel ?? '').replace(/\\s+/g, ' ').trim().toLowerCase();\n    if (!wanted) {\n        throw new ArgumentError('--pick label cannot be empty');\n    }\n    const normalized = options.map((option, index) => ({\n        index,\n        title: String(option.title ?? ''),\n        normalizedTitle: String(option.title ?? '').replace(/\\s+/g, ' ').trim().toLowerCase(),\n        normalizedText: String(option.text ?? option.title ?? '').replace(/\\s+/g, ' ').trim().toLowerCase(),\n    }));\n    const exact = normalized.filter(item => item.normalizedTitle === wanted);\n    if (exact.length === 1) {\n        return exact[0];\n    }\n    if (exact.length > 1) {\n        throw new CommandExecutionError(`Picker option \"${rawLabel}\" is ambiguous.`, `Matches: ${exact.map(item => item.title).join(', ')}`);\n    }\n    const partial = normalized.filter(item => item.normalizedText.includes(wanted));\n    if (partial.length === 1) {\n        return partial[0];\n    }\n    if (partial.length > 1) {\n        throw new CommandExecutionError(`Picker option \"${rawLabel}\" is ambiguous.`, `Matches: ${partial.map(item => item.title).join(', ')}`);\n    }\n    return null;\n}\n\nfunction normalizeChipText(value) {\n    return String(value ?? '').toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();\n}\n\nexport function chipMatchesLabel(chip, label) {\n    const wanted = normalizeChipText(label);\n    if (!wanted) {","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/codex/send.js#L6-L42","documentation":"When matching --pick against picker options, the library first looks for an exact (case/whitespace-insensitive) title match. If more than one option's normalized title equals the wanted label, it throws CommandExecutionError with the list of matching titles rather than guessing.","triggerScenarios":"Calling send with --pick whose trimmed/lowercased label exactly equals the title of two or more open picker options, e.g. duplicate option titles rendered in the picker.","commonSituations":"Two picker entries share the same title (e.g. similarly named slash commands or repeated suggestions); using a very short/generic label like 'fix' that matches multiple items verbatim.","solutions":["Use a longer, more specific --pick label that matches only one option.","Inspect the 'Matches: ...' detail in the error and pick one of the listed titles, disambiguating by a distinguishing suffix.","If options are genuinely duplicated, shorten or retype the composer text so the picker shows fewer candidates."],"exampleFix":"// before\n--pick \"review\"\n// CommandExecutionError: Picker option \"review\" is ambiguous. Matches: review, Review\n\n// after\n--pick \"review PR feedback\"","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await codexSend({ text, pick });\n} catch (e) {\n  if (e instanceof CommandExecutionError && /ambiguous/.test(e.message)) {\n    const matches = e.detail.match(/Matches: (.*)/)?.[1]?.split(', ') ?? [];\n    if (matches.length === 1) return codexSend({ text, pick: matches[0] });\n    console.error('Pick one exactly:', matches);\n  }\n  throw e;\n}","preventionTips":["Use full, unique option titles in --pick rather than short generic words.","Inspect the 'Matches:' detail and pick a distinguishing longer label.","Automate a uniqueness check: label must exactly match exactly one known option."],"tags":["ambiguity","picker","codex","ui-automation"],"backgroundTag":"ambiguous-match","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}