{"record":{"id":"88128f229d970ab9","repo":"jackwener/OpenCLI","slug":"lesswrong-read-post-postid-not-found","errorCode":null,"errorMessage":"lesswrong read: Post \"${postId}\" not found","messagePattern":"lesswrong read: Post \"(.+?)\" not found","errorType":"error_code","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/lesswrong/read.js","lineNumber":32,"sourceCode":"            name: 'url-or-id',\n            type: 'string',\n            required: true,\n            positional: true,\n            help: 'Post URL or LessWrong post ID',\n        },\n    ],\n    columns: ['title', 'author', 'karma', 'comments', 'tags', 'content', 'url'],\n    func: async (kwargs) => {\n        const postId = parsePostId(String(kwargs['url-or-id']));\n        const query = `query PostsSingle {\n      post(input: {selector: {documentId: \"${gqlEscape(postId)}\"}}) {\n        result { _id title user { displayName } baseScore commentCount htmlBody slug postedAt tags { name } }\n      }\n    }`;\n        const data = await gqlRequest(query);\n        const post = data?.post?.result;\n        if (!post?._id) {\n            throw new EmptyResultError('lesswrong read', `Post \"${postId}\" not found`);\n        }\n        return [\n            {\n                title: post.title ?? '',\n                author: post.user?.displayName ?? '',\n                karma: post.baseScore ?? 0,\n                comments: post.commentCount ?? 0,\n                tags: (post.tags ?? []).map((tag) => tag.name ?? '').filter(Boolean).join(', '),\n                content: stripHtml(post.htmlBody ?? ''),\n                url: `https://${DOMAIN}/posts/${post._id}/${post.slug}`,\n            },\n        ];\n    },\n});\n","sourceCodeStart":14,"sourceCodeEnd":47,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/lesswrong/read.js#L14-L47","documentation":"lesswrong read fetches a single post's data; if data.post.result has no _id the command throws EmptyResultError with the postId embedded. It means the requested post ID did not resolve to a readable post.","triggerScenarios":"read invoked with an invalid, deleted, draft, or non-post identifier; parsePostId output from an unrelated URL; GraphQL returned null for that ID.","commonSituations":"Deleted or unlisted posts; IDs copied from search result snippets that were truncated; confusion between tag/comment IDs and post IDs; old posts migrated to new IDs.","solutions":["Verify the ID/URL resolves on lesswrong.com in a browser","Re-copy the post URL and pass the whole URL so parsePostId extracts the ID","Search the post title via lesswrong search to get the current ID","Check for typos or missing characters in the ID"],"exampleFix":"// before\nawait lesswrongRead('4KpDw');\n// after\nawait lesswrongRead('https://www.lesswrong.com/posts/yRBsqzYhXcFvpWvKi/title-slug');","handlingStrategy":"validation","validationCode":"const postId = parsePostId(urlOrId); // pass full URL\nif (!postId || postId.length < 6) throw new Error('bad post id');","typeGuard":"const postExists = (d) => typeof d?.post?.result?._id === 'string';","tryCatchPattern":"try {\n  await lesswrongRead(postId);\n} catch (e) {\n  if (String(e.message).includes('not found')) console.error(`Post ${postId} unavailable`);\n  else throw e;\n}","preventionTips":["Prefer full post URLs over manually copied IDs","Check the post is public (not draft/deleted)","Search by title if the ID fails","Validate IDs against the /posts/<id> page"],"tags":["empty-result","lesswrong","post-id","user-input"],"backgroundTag":"resource-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}