{"record":{"id":"b274c2e3fc05d192","repo":"jackwener/OpenCLI","slug":"designer-is-required-for-example-halolab","errorCode":null,"errorMessage":"designer is required (for example: halolab)","messagePattern":"designer is required \\(for example: halolab\\)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/dribbble/utils.js","lineNumber":41,"sourceCode":"    return limit;\n}\n\nexport function requireQuery(value, label = 'query') {\n    const query = String(value ?? '').trim();\n    if (!query) throw new ArgumentError(`${label} is required`);\n    if (query.length > 100) throw new ArgumentError(`${label} must be <= 100 characters`);\n    return query;\n}\n\nexport function optionalQuery(value, label = 'query') {\n    const query = String(value ?? '').trim();\n    if (query.length > 100) throw new ArgumentError(`${label} must be <= 100 characters`);\n    return query;\n}\n\nexport function requireDesigner(value) {\n    const designer = String(value ?? '').trim();\n    if (!designer) throw new ArgumentError('designer is required (for example: halolab)');\n    if (!/^[A-Za-z0-9_-]{1,100}$/.test(designer)) {\n        throw new ArgumentError('designer must be a Dribbble username or profile slug');\n    }\n    return designer;\n}\n\nexport function requireShotTarget(value) {\n    const target = String(value ?? '').trim();\n    if (!target) throw new ArgumentError('shot is required (numeric id or dribbble.com/shots URL)');\n    if (/^\\d+$/.test(target)) return target;\n\n    let url;\n    try {\n        url = new URL(target);\n    } catch {\n        throw new ArgumentError('shot must be a numeric id or dribbble.com/shots URL');\n    }\n    if (!/(^|\\.)dribbble\\.com$/i.test(url.hostname)) {","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/dribbble/utils.js#L23-L59","documentation":"requireDesigner validates the Dribbble designer argument before any scraping command runs. It throws this ArgumentError when the value is missing, empty, or only whitespace after String coercion and trim. The library refuses to proceed without a designer slug because every designer-based lookup URL depends on it.","triggerScenarios":"Calling any command that resolves through `designer` (which calls requireDesigner) with: undefined/null, an empty string, a string of only spaces, or a non-string value that coerces to '' (e.g. 0 is fine but '' is not).","commonSituations":"Forgetting to pass the designer flag on the CLI, reading the value from an unset environment variable or empty config field, or a script variable that is empty because an earlier lookup returned nothing.","solutions":["Pass a Dribbble username or profile slug (e.g. 'halolab') to the command or API call.","Check where the value comes from (env var, config file, CLI flag) and confirm it is set and non-blank.","Trim user input before passing it so whitespace-only values become real values or are rejected earlier with a clearer message."],"exampleFix":"// before\ncli.shots({ designer: process.env.DRIBBBLE_DESIGNER }) // env var unset\n\n// after\nconst designer = process.env.DRIBBBLE_DESIGNER || 'halolab';\ncli.shots({ designer });","handlingStrategy":"validation","validationCode":"const designer = typeof value === 'string' ? value.trim() : '';\nif (!designer) throw new Error('designer is required before calling this command');","typeGuard":"function isValidDesigner(v) {\n  return typeof v === 'string' && /^[A-Za-z0-9_-]{1,100}$/.test(v.trim());\n}","tryCatchPattern":"try {\n  const rows = command({ designer });\n} catch (e) {\n  if (e instanceof ArgumentError && /designer is required/.test(e.message)) {\n    console.error('Missing --designer argument; pass a Dribbble username, e.g. halolab');\n    process.exitCode = 1;\n    return;\n  }\n  throw e;\n}","preventionTips":["Make the designer flag required in your CLI/config parser so it fails fast with your own message.","Trim and default-check values sourced from env vars or config files before use.","Keep a lint/CI assertion that all command invocations supply a non-empty designer."],"tags":["argument-validation","missing-argument","input-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}