{"record":{"id":"d0cef54fd90bdf6f","repo":"jackwener/OpenCLI","slug":"label-is-required-d0cef5","errorCode":null,"errorMessage":"${label} is required","messagePattern":"(.+?) is required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/linkedin/people-search.js","lineNumber":16,"sourceCode":"/**\n * LinkedIn people-search via SSR DOM text-slice. Voyager people-search\n * REST returns HTTP 500 from a web context; LinkedIn renders results\n * server-side now. One navigation per call consumes one CUL query.\n */\nimport { cli, Strategy } from '@jackwener/opencli/registry';\nimport { ArgumentError, AuthRequiredError, CommandExecutionError, EmptyResultError } from '@jackwener/opencli/errors';\nimport { looksLinkedInAuthWall, normalizeWhitespace, unwrapEvaluateResult } from './shared.js';\n\nconst LINKEDIN_DOMAIN = 'www.linkedin.com';\nconst SEARCH_URL_BASE = 'https://www.linkedin.com/search/results/people/';\nconst MAX_LIMIT = 10;\n\nfunction requireStringArg(args, key, label = key) {\n    const value = normalizeWhitespace(args[key]);\n    if (!value) throw new ArgumentError(`${label} is required`);\n    return value;\n}\n\nfunction parseLimit(value) {\n    if (value === undefined || value === null || value === '') return 5;\n    const limit = Number(value);\n    if (!Number.isInteger(limit) || limit < 1 || limit > MAX_LIMIT) {\n        throw new ArgumentError(`--limit must be an integer between 1 and ${MAX_LIMIT}`);\n    }\n    return limit;\n}\n\nfunction buildSearchUrl(keywords) {\n    return SEARCH_URL_BASE + '?keywords=' + encodeURIComponent(keywords);\n}\n\nfunction normalizeProfileUrl(value) {\n    const raw = normalizeWhitespace(value);","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin/people-search.js#L1-L34","documentation":"ArgumentError thrown by requireStringArg in clis/linkedin/people-search.js when the requested argument normalizes to an empty string. It is the standard guard ensuring a mandatory CLI argument (e.g. --keywords for people search) is present and non-blank before building the search URL.","triggerScenarios":"Running linkedin people-search without the keywords argument, or passing only whitespace (\"   \") which normalizeWhitespace collapses to ''.","commonSituations":"Forgetting --keywords on the command line; shell variable expansion producing an empty string (keywords=\"$EMPTY\"); quoting mistakes so the flag value never reaches args.","solutions":["Pass the keywords argument: linkedin people-search --keywords \"software engineer\"","Check that the shell variable feeding the flag is non-empty","Quote multi-word keywords so argument parsing receives the full value","Wrap command invocation with a check that required args are set"],"exampleFix":"// before\nawait runCli(['people-search', '--keywords', keywordsVar]); // keywordsVar === ''\n// after\nif (!keywordsVar.trim()) throw new Error('keywords is required before invoking people-search');\nawait runCli(['people-search', '--keywords', keywordsVar]);","handlingStrategy":"validation","validationCode":"function validateKeywords(args) {\n  const value = (args.keywords || '').trim();\n  if (!value) throw new Error(\"keywords is required: pass --keywords \\\"your search terms\\\"\");\n  return value;\n}","typeGuard":null,"tryCatchPattern":"try {\n  const rows = await runCli(['linkedin', 'people-search', '--keywords', kw]);\n} catch (err) {\n  if (String(err.message).endsWith('is required')) {\n    console.error('Usage: people-search --keywords \"<terms>\"');\n    process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Always quote multi-word keyword values on the command line","Check shell variables are non-empty before interpolating into flags","Add argument pre-checks in wrapper scripts before invoking the CLI","Use the command's help output to confirm required positional/flag args"],"tags":["argument-validation","cli","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}