jackwener/OpenCLI · warning · EmptyResultError

lesswrong tag ${tagInput}: Use "opencli lesswrong tags" to l

Error message

lesswrong tag ${tagInput}: Use "opencli lesswrong tags" to list available tags

What it means

lesswrong tag resolves the tag input to a tag ID via resolveTagId; when the result lacks _id it throws EmptyResultError advising the user to run 'opencli lesswrong tags' to list valid tags. The supplied tag name did not match any LessWrong tag.

Source

Thrown at clis/lesswrong/tag.js:28

    strategy: Strategy.PUBLIC,
    browser: false,
    args: [
        {
            name: 'tag',
            type: 'string',
            required: true,
            positional: true,
            help: 'Tag slug or name',
        },
        { name: 'limit', type: 'int', default: 10, help: 'Number of results' },
    ],
    columns: ['rank', 'title', 'author', 'karma', 'comments', 'url'],
    func: async (kwargs) => {
        const tagInput = String(kwargs.tag);
        const limit = Number(kwargs.limit ?? 10);
        const tag = await resolveTagId(tagInput);
        if (!tag?._id) {
            throw new EmptyResultError(`lesswrong tag ${tagInput}`, 'Use "opencli lesswrong tags" to list available tags');
        }
        const query = `query PostsByTag {
      posts(input: {terms: {view: "tagRelevance", tagId: "${tag._id}", limit: ${limit}}}) {
        results { _id title user { displayName } baseScore commentCount slug postedAt }
      }
    }`;
        const data = await gqlRequest(query);
        const posts = (data?.posts?.results ?? []);
        return posts.map((item, i) => ({
            rank: i + 1,
            title: item.title ?? '',
            author: item.user?.displayName ?? '',
            karma: item.baseScore ?? 0,
            comments: item.commentCount ?? 0,
            url: `https://${DOMAIN}/posts/${item._id}/${item.slug}`,
        }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Run 'opencli lesswrong tags' to list available tags and copy the exact name
  2. Match the tag's canonical casing (e.g. 'AI', 'Alignment') as shown in the list
  3. Search lesswrong.com/tags to confirm the tag exists
  4. Use a related existing tag if the requested one was retired

Example fix

// before
await lesswrongTag('ai safety');
// after
await lesswrongTag('AI Risk'); // exact tag from `opencli lesswrong tags`
Defensive patterns

Strategy: validation

Validate before calling

const knownTags = await opencli.lesswrong.tags();
if (!knownTags.some(t => t.name.toLowerCase() === tagInput.toLowerCase())) throw new Error(`unknown tag: ${tagInput}`);

Type guard

const tagResolved = (t) => typeof t?._id === 'string' && t._id.length > 0;

Try / catch

try {
  await lesswrongTag(tagInput);
} catch (e) {
  if (String(e.message).includes('lesswrong tags')) console.error(`Tag "${tagInput}" not found — run 'opencli lesswrong tags'`);
  else throw e;
}

Prevention

When it happens

Trigger: Calling lesswrong tag with a tag slug/name that doesn't exist, mismatched case or spelling, or a phrase not registered as a tag on LessWrong.

Common situations: Using informal terms ('ai-risk' vs actual tag 'AI'); capitalization/slug mismatch; tag renamed or retired; assuming Reddit-style tags exist on LessWrong.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/4ac077958ad80dee. Report an issue: GitHub.