{"record":{"id":"4ac077958ad80dee","repo":"jackwener/OpenCLI","slug":"lesswrong-tag-taginput-use-opencli-lesswrong","errorCode":null,"errorMessage":"lesswrong tag ${tagInput}: Use \"opencli lesswrong tags\" to list available tags","messagePattern":"lesswrong tag (.+?): Use \"opencli lesswrong tags\" to list available tags","errorType":"error_code","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/lesswrong/tag.js","lineNumber":28,"sourceCode":"    strategy: Strategy.PUBLIC,\n    browser: false,\n    args: [\n        {\n            name: 'tag',\n            type: 'string',\n            required: true,\n            positional: true,\n            help: 'Tag slug or name',\n        },\n        { name: 'limit', type: 'int', default: 10, help: 'Number of results' },\n    ],\n    columns: ['rank', 'title', 'author', 'karma', 'comments', 'url'],\n    func: async (kwargs) => {\n        const tagInput = String(kwargs.tag);\n        const limit = Number(kwargs.limit ?? 10);\n        const tag = await resolveTagId(tagInput);\n        if (!tag?._id) {\n            throw new EmptyResultError(`lesswrong tag ${tagInput}`, 'Use \"opencli lesswrong tags\" to list available tags');\n        }\n        const query = `query PostsByTag {\n      posts(input: {terms: {view: \"tagRelevance\", tagId: \"${tag._id}\", limit: ${limit}}}) {\n        results { _id title user { displayName } baseScore commentCount slug postedAt }\n      }\n    }`;\n        const data = await gqlRequest(query);\n        const posts = (data?.posts?.results ?? []);\n        return posts.map((item, i) => ({\n            rank: i + 1,\n            title: item.title ?? '',\n            author: item.user?.displayName ?? '',\n            karma: item.baseScore ?? 0,\n            comments: item.commentCount ?? 0,\n            url: `https://${DOMAIN}/posts/${item._id}/${item.slug}`,\n        }));\n    },\n});","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/lesswrong/tag.js#L10-L46","documentation":"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.","triggerScenarios":"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.","commonSituations":"Using informal terms ('ai-risk' vs actual tag 'AI'); capitalization/slug mismatch; tag renamed or retired; assuming Reddit-style tags exist on LessWrong.","solutions":["Run 'opencli lesswrong tags' to list available tags and copy the exact name","Match the tag's canonical casing (e.g. 'AI', 'Alignment') as shown in the list","Search lesswrong.com/tags to confirm the tag exists","Use a related existing tag if the requested one was retired"],"exampleFix":"// before\nawait lesswrongTag('ai safety');\n// after\nawait lesswrongTag('AI Risk'); // exact tag from `opencli lesswrong tags`","handlingStrategy":"validation","validationCode":"const knownTags = await opencli.lesswrong.tags();\nif (!knownTags.some(t => t.name.toLowerCase() === tagInput.toLowerCase())) throw new Error(`unknown tag: ${tagInput}`);","typeGuard":"const tagResolved = (t) => typeof t?._id === 'string' && t._id.length > 0;","tryCatchPattern":"try {\n  await lesswrongTag(tagInput);\n} catch (e) {\n  if (String(e.message).includes('lesswrong tags')) console.error(`Tag \"${tagInput}\" not found — run 'opencli lesswrong tags'`);\n  else throw e;\n}","preventionTips":["List tags first and copy exact names/casing","Search lesswrong.com/tags to confirm existence","Cache the tag list to validate inputs offline","Use canonical tag names, not paraphrases"],"tags":["empty-result","tag","lesswrong","user-input"],"backgroundTag":"resource-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}