jackwener/OpenCLI · error · ArgumentError
query is required
Error message
query is required
What it means
The pinterest search-users CLI command requires a positional 'query' argument. Empty, undefined, or whitespace-only values are rejected with ArgumentError before navigating to /search/users/?q=, since a blank user search is meaningless.
Source
Thrown at clis/pinterest/search-users.js:23
const DEFAULT_LIMIT = 25;
const MAX_LIMIT = 100;
cli({
site: 'pinterest',
name: 'search-users',
access: 'read',
description: 'Search for users on Pinterest',
domain: 'www.pinterest.com',
strategy: Strategy.COOKIE,
args: [
{ name: 'query', type: 'string', positional: true, required: true, help: 'Search keyword' },
{ name: 'limit', type: 'int', default: DEFAULT_LIMIT, help: `Number of users (max ${MAX_LIMIT})` },
],
columns: ['username', 'fullName', 'followerCount', 'pinCount', 'url'],
func: async (page, kwargs) => {
const query = String(kwargs.query ?? '').trim();
if (!query) throw new ArgumentError('query is required');
const limit = requireLimit(kwargs.limit, { fallback: DEFAULT_LIMIT, max: MAX_LIMIT });
const sourceUrl = `/search/users/?q=${encodeURIComponent(query)}`;
await page.goto(`${PINTEREST_BASE}${sourceUrl}`);
const rows = await collectResults(page, {
resource: 'BaseSearchResource',
baseOptions: { query, scope: 'users' },
sourceUrl,
limit,
keyField: 'username',
pageSize: DEFAULT_PAGE_SIZE,
mapItem: (user) => {
if (!user || user.type !== 'user' || !user.username) return null;
return {
username: user.username,
fullName: (user.full_name || '').trim(),
followerCount: typeof user.follower_count === 'number' ? user.follower_count : 0,View on GitHub (pinned to 49907e53dc)
Solutions
- Pass a non-empty keyword: pinterest search-users " photography"
- Validate the input variable in your shell script before invoking the command
- Quote arguments containing spaces so the shell passes them as one value
Example fix
// before
pinterest search-users $NAME // NAME="" or unquoted with spaces
// after
pinterest search-users "${NAME:?NAME is required}" Defensive patterns
Strategy: validation
Validate before calling
[ -z "${NAME:-}" ] && { echo 'query is required' >&2; exit 2; }
pinterest search-users "$NAME" Type guard
const isNonEmptyString = (v) => typeof v === 'string' && v.trim().length > 0;
Prevention
- Use ${VAR:?msg} parameter expansion to hard-fail on unset variables
- Prompt-verify interactive input is non-blank before exec
- Keep required arguments out of optional flag parsing paths
When it happens
Trigger: Running `pinterest search-users` with the positional keyword omitted, empty, or only spaces, making the trimmed query falsy.
Common situations: Interactive scripts where the user pressed Enter on an empty prompt, CI jobs with an unset input variable, or arguments lost due to unquoted shell expansion.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- keyword must not be empty
- <from> station must not be empty
- <to> station must not be empty
- who 不能为空
- key is required
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/c7563b5a5ce7f617.
Report an issue: GitHub.