jackwener/OpenCLI · warning · EmptyResultError
lesswrong user ${String(kwargs.username)}: Check the usernam
Error message
lesswrong user ${String(kwargs.username)}: Check the username — LessWrong slugs are lowercase (e.g. "zvi", "eliezer-yudkowsky") What it means
lesswrong user queries the GraphQL user endpoint for the given username; when data.user.result has no _id it throws EmptyResultError with the lowercase-slug hint. The username supplied did not resolve to a user profile.
Source
Thrown at clis/lesswrong/user.js:32
name: 'username',
type: 'string',
required: true,
positional: true,
help: 'LessWrong username or slug',
},
],
columns: ['field', 'value'],
func: async (kwargs) => {
const slug = gqlEscape(String(kwargs.username).toLowerCase());
const query = `query UserProfile {
user(input: {selector: {slug: "${slug}"}}) {
result { _id displayName slug bio karma postCount commentCount createdAt }
}
}`;
const data = await gqlRequest(query);
const user = data?.user?.result;
if (!user?._id) {
throw new EmptyResultError(`lesswrong user ${String(kwargs.username)}`, 'Check the username — LessWrong slugs are lowercase (e.g. "zvi", "eliezer-yudkowsky")');
}
return [
{ field: 'Name', value: user.displayName ?? '' },
{ field: 'Username', value: user.slug ?? '' },
{ field: 'Karma', value: user.karma ?? 0 },
{ field: 'Posts', value: user.postCount ?? 0 },
{ field: 'Comments', value: user.commentCount ?? 0 },
{ field: 'Joined', value: user.createdAt ?? '' },
{ field: 'Bio', value: stripHtml(user.bio ?? '') },
{ field: 'URL', value: `https://${DOMAIN}/users/${user.slug}` },
];
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Convert the username to a lowercase hyphenated slug before calling
- Confirm the slug from the user's profile URL on lesswrong.com
- Check the account still exists and was not renamed or deleted
- Retry in case of a transient GraphQL failure
Example fix
// before
await lesswrongUser('Eliezer Yudkowsky');
// after
await lesswrongUser('eliezer-yudkowsky'); Defensive patterns
Strategy: validation
Validate before calling
function toLwSlug(name){ const s = String(name).trim().toLowerCase().replace(/\s+/g,'-'); if(!/^[a-z0-9-]+$/.test(s)) throw new Error('invalid LessWrong slug'); return s; } Type guard
const isUser = (d) => typeof d?.user?.result?._id === 'string';
Try / catch
try {
await lesswrongUser(username);
} catch (e) {
if (e.name === 'EmptyResultError') {
return lesswrongUser(username.trim().toLowerCase().replace(/\s+/g, '-'));
}
throw e;
} Prevention
- Normalize usernames to slugs before lookup
- Take slugs from profile URLs
- Check the account is active on lesswrong.com
- Retry transient nulls once before failing
When it happens
Trigger: lesswrong user called with a non-slug form (mixed case, spaces, display name), a nonexistent username, or a deleted account, so the GraphQL user lookup returns null result.
Common situations: Typing a display name ('Rob Bensinger') instead of the slug ('rob-bensinger'); capitalization ('Raemon' vs 'raemon'); user deactivated their account; typo in the handle.
Understand the failure class
Background: "User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm — this error's family across 10 libraries.
Related errors
- Check the username — LessWrong slugs are lowercase (e.g. "zv
- lesswrong comments: Post "${postId}" not found
- lesswrong read: Post "${postId}" not found
- lesswrong tag ${tagInput}: Use "opencli lesswrong tags" to l
- dongchedi search "${keyword}": No car series matched. Try th
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/c549284ab5c01ce1.
Report an issue: GitHub.