jackwener/OpenCLI · error · ArgumentError
designer must be a Dribbble username or profile slug
Error message
designer must be a Dribbble username or profile slug
What it means
requireDesigner enforces the Dribbble username/slug format: 1-100 characters of letters, digits, underscore, or hyphen. This ArgumentError is thrown when the supplied designer value is non-empty but contains characters outside that set, so it cannot be a valid profile slug.
Source
Thrown at clis/dribbble/utils.js:43
export function requireQuery(value, label = 'query') {
const query = String(value ?? '').trim();
if (!query) throw new ArgumentError(`${label} is required`);
if (query.length > 100) throw new ArgumentError(`${label} must be <= 100 characters`);
return query;
}
export function optionalQuery(value, label = 'query') {
const query = String(value ?? '').trim();
if (query.length > 100) throw new ArgumentError(`${label} must be <= 100 characters`);
return query;
}
export function requireDesigner(value) {
const designer = String(value ?? '').trim();
if (!designer) throw new ArgumentError('designer is required (for example: halolab)');
if (!/^[A-Za-z0-9_-]{1,100}$/.test(designer)) {
throw new ArgumentError('designer must be a Dribbble username or profile slug');
}
return designer;
}
export function requireShotTarget(value) {
const target = String(value ?? '').trim();
if (!target) throw new ArgumentError('shot is required (numeric id or dribbble.com/shots URL)');
if (/^\d+$/.test(target)) return target;
let url;
try {
url = new URL(target);
} catch {
throw new ArgumentError('shot must be a numeric id or dribbble.com/shots URL');
}
if (!/(^|\.)dribbble\.com$/i.test(url.hostname)) {
throw new ArgumentError('shot URL must use dribbble.com');
}View on GitHub (pinned to 49907e53dc)
Solutions
- Strip the value down to the slug: take the last path segment of a profile URL and remove any leading '@'.
- Validate locally with /^[A-Za-z0-9_-]{1,100}$/ before calling the library.
- Reject or normalize input containing spaces, slashes, or non-ASCII characters at the point of collection.
Example fix
// before
cli.shots({ designer: 'https://dribbble.com/halolab' })
// after
const designer = 'https://dribbble.com/halolab'.split('/').pop().replace(/^@/, '');
cli.shots({ designer }); // 'halolab' Defensive patterns
Strategy: validation
Validate before calling
function normalizeDesigner(input) {
if (typeof input !== 'string') throw new Error('designer must be a string');
const slug = input.trim().replace(/^@/, '').split('/').pop();
if (!/^[A-Za-z0-9_-]{1,100}$/.test(slug)) throw new Error(`invalid designer slug: ${input}`);
return slug;
} Type guard
function isDesignerSlug(v) {
return typeof v === 'string' && v.trim().length > 0 && v.trim().length <= 100 && /^[A-Za-z0-9_-]+$/.test(v.trim());
} Try / catch
try {
const rows = command({ designer });
} catch (e) {
if (e instanceof ArgumentError && /Dribbble username or profile slug/.test(e.message)) {
console.error(`'${designer}' is not a valid slug; use only letters, digits, '_' or '-'`);
return;
}
throw e;
} Prevention
- Normalize URLs and @handles to bare slugs at the boundary where input is collected.
- Reuse the same /^[A-Za-z0-9_-]{1,100}$/ regex in your own validation so errors surface earlier.
- Document in team docs that designer input is a slug, never a full URL.
When it happens
Trigger: Passing a full profile URL (e.g. 'https://dribbble.com/halolab'), a value with spaces or '@' (e.g. '@halolab', 'halo lab'), unicode names, or names longer than 100 characters into a designer-based command.
Common situations: Copy-pasting the whole Dribbble profile URL instead of the slug, prefixing the handle with '@', or collecting the designer name from free-form user input without sanitizing it.
Related errors
- coingecko currency must look like a currency slug (got "${ar
- shot must be a numeric id or dribbble.com/shots URL
- shot URL must match dribbble.com/shots/<id>
- flathub appId "${value}" is not a valid AppStream identifier
- hf paper id "${args.id}" is not a valid arXiv id
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/3229aed812de7992.
Report an issue: GitHub.