{"record":{"id":"e21903c14a68eb6c","repo":"jackwener/OpenCLI","slug":"destination-is-required","errorCode":null,"errorMessage":"destination is required","messagePattern":"destination is required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/booking/search.js","lineNumber":241,"sourceCode":"    { name: 'offset', type: 'int', default: 0, help: 'Result offset for pagination (multiple of 25)' },\n  ],\n  columns: [\n    'rank',\n    'name',\n    'country',\n    'slug',\n    'star_rating',\n    'review_score',\n    'review_count',\n    'price_amount',\n    'price_currency',\n    'distance',\n    'recommended_room',\n    'url',\n  ],\n  func: async (page, kwargs) => {\n    const destination = String(kwargs.destination || '').trim();\n    if (!destination) throw new ArgumentError('destination is required');\n    const checkin = normalizeDate(kwargs.checkin, 'checkin');\n    const checkout = normalizeDate(kwargs.checkout, 'checkout');\n    if (checkin >= checkout) {\n      throw new ArgumentError(`checkout (${checkout}) must be after checkin (${checkin})`);\n    }\n    const adults = normalizePositiveInt(kwargs.adults, 2, 'adults', 30);\n    const rooms = normalizePositiveInt(kwargs.rooms, 1, 'rooms', 30);\n    const children = normalizeNonNegativeInt(kwargs.children, 0, 'children', 10);\n    const currency = normalizeCurrency(kwargs.currency);\n    const lang = normalizeLang(kwargs.lang);\n    const limit = normalizePositiveInt(kwargs.limit, 25, 'limit', 100);\n    const offset = normalizeNonNegativeInt(kwargs.offset, 0, 'offset', 1000);\n\n    const url = buildSearchUrl({ destination, checkin, checkout, adults, rooms, children, offset, currency, lang });\n\n    try {\n      await page.goto(url);\n    } catch (err) {","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/booking/search.js#L223-L259","documentation":"The search command's func reads kwargs.destination, trims it, and throws ArgumentError when the result is empty. A destination is mandatory for every search, so the command fails fast before any date normalization or page navigation. This guards against null/undefined/empty-string/whitespace-only destination values.","triggerScenarios":"Calling the search tool with destination omitted, null, undefined, '' or '   '; programmatic callers spreading kwargs from an object where destination was never set; form submissions that allow blank destination.","commonSituations":"Forgotten required field in a wrapper script; a UI allowing 'search anywhere' which this CLI does not support; env/config keys spelled differently (DESTINATION vs destination) yielding undefined; JSON kwargs with a null destination.","solutions":["Pass a non-empty destination string, e.g. 'Tokyo' or 'Paris, France'","Check that the key is exactly 'destination' (no typo, correct casing) in your kwargs/config","Trim and validate the value before calling; reject blank/whitespace-only input early in your own code","If searches without a destination are legitimate for your use case, this CLI cannot do them — supply at least a city/region"],"exampleFix":"// before\nawait search(page, { checkin: '2026-09-01', checkout: '2026-09-05' });\n// after\nawait search(page, { destination: 'Tokyo', checkin: '2026-09-01', checkout: '2026-09-05' });","handlingStrategy":"validation","validationCode":"function assertDestination(kwargs) {\n  const d = String(kwargs.destination ?? '').trim();\n  if (!d) throw new Error('destination is required before calling search');\n  return d;\n}","typeGuard":"function hasDestination(kwargs) {\n  return typeof kwargs.destination === 'string' && kwargs.destination.trim().length > 0;\n}","tryCatchPattern":"try {\n  await search(page, kwargs);\n} catch (e) {\n  if (e.message === 'destination is required') {\n    throw new Error('Provide a destination (city/region) to search');\n  } else throw e;\n}","preventionTips":["Validate required kwargs at the entry point of your wrapper code","Check key spelling and casing ('destination', not 'Destination' or 'location')","Do not allow blank/whitespace-only destination input in forms that feed this CLI","Default-fill a destination from context if your workflow can search 'near me' equivalents"],"tags":["validation","argument-error","required-parameter"],"backgroundTag":"missing-required-parameter","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}