jackwener/OpenCLI · error · EmptyResultError
pinterest user
Error message
pinterest user
What it means
EmptyResultError from pinterest user: the UserResource API call with field_set_key 'profile' returned no user object (or one without a username), meaning the profile could not be resolved. The command throws so callers get a clear 'user not found' signal instead of undefined data.
Source
Thrown at clis/pinterest/user.js:30
strategy: Strategy.COOKIE,
args: [
{ name: 'username', type: 'string', positional: true, required: true, help: 'Username or profile URL, e.g. janedoe' },
],
columns: ['username', 'fullName', 'followerCount', 'followingCount', 'interestFollowingCount', 'pinCount', 'boardCount', 'about', 'website', 'url'],
func: async (page, kwargs) => {
const username = parseUsername(kwargs.username);
const sourceUrl = `/${username}/`;
await page.goto(`${PINTEREST_BASE}${sourceUrl}`);
const { data: user } = await pinterestResourceFetch(
page,
'UserResource',
{ username, field_set_key: 'profile' },
sourceUrl,
);
if (!user || !user.username) {
throw new EmptyResultError('pinterest user', `user "${username}" not found`);
}
const num = (value) => (typeof value === 'number' ? value : 0);
return [{
username: user.username,
fullName: (user.full_name || '').trim(),
followerCount: num(user.follower_count),
// following_count is Pinterest's API total (followed people + topics/interests).
followingCount: num(user.following_count),
interestFollowingCount: num(user.interest_following_count),
pinCount: num(user.pin_count),
boardCount: num(user.board_count),
about: (user.about || '').trim(),
website: user.domain_url || '',
url: `${PINTEREST_BASE}/${user.username}/`,
}];
},
});View on GitHub (pinned to 49907e53dc)
Solutions
- Verify the username by opening https://pinterest.com/<username>/ in a browser
- Correct stale usernames from your data source (renamed handles are common)
- Retry after a delay/backoff if the account is known-good — empty UserResource responses can be transient
- Catch EmptyResultError and mark the account as missing/unavailable in your pipeline
Example fix
// before
const user = await pinterest.user({ username: 'old_handle' }); // throws if gone
// after
try {
return await pinterest.user({ username: 'old_handle' });
} catch (e) {
if (e.name === 'EmptyResultError') return { status: 'user-not-found' };
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!/^[A-Za-z0-9_]{3,}$/.test(username)) throw new Error('pre-check: username looks invalid'); Try / catch
try { user = await pinterest.user({ username }); }
catch (e) {
if (e.name === 'EmptyResultError') return { found: false, username };
throw e;
} Prevention
- Resolve usernames from source URLs shortly after collecting them — handles get renamed
- Retry with backoff before declaring a known-good account missing
- Check for typos and account suspension when a profile 404s in the browser too
When it happens
Trigger: Requesting /<username>/ where the account does not exist, was deleted or suspended, is private, or where the UserResource response arrives empty (rate limit, region block, or markup/API change).
Common situations: Typos in the username, following a stale cached username after the user renamed their handle, scraping deactivated accounts from an old list, or Pinterest throttling the automation session.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- pinterest user-boards
- pinterest user-pins
- No series found for '${brand}'. Check the brand name spellin
- This series has no koubei rating yet.
- ${command} returned no results
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/c2117bbc921089a4.
Report an issue: GitHub.