{"record":{"id":"ea16787bf517fd3c","repo":"jackwener/OpenCLI","slug":"draft-id-was-not-found-in-drafttype-drafts-ea1678","errorCode":null,"errorMessage":"Draft ${id} was not found in ${draftType} drafts. Run opencli xiaohongshu drafts --type ${draftType} to list current ids.","messagePattern":"Draft (.+?) was not found in (.+?) drafts\\. Run opencli xiaohongshu drafts --type (.+?) to list current ids\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/xiaohongshu/draft-open.js","lineNumber":32,"sourceCode":"    name: 'draft-open',\n    access: 'read',\n    description: '读取一条小红书本地草稿详情',\n    domain: 'creator.xiaohongshu.com',\n    strategy: Strategy.COOKIE,\n    browser: true,\n    navigateBefore: false,\n    args: [\n        { name: 'id', positional: true, required: true, help: 'Draft id returned by `opencli xiaohongshu drafts`' },\n        { name: 'type', default: 'image', help: 'Draft type: image, video, article, audio' },\n    ],\n    columns: ['id', 'type', 'title', 'updated_at', 'images', 'content'],\n    func: async (page, kwargs) => {\n        const id = normalizeDraftId(kwargs.id);\n        const draftType = normalizeDraftType(kwargs.type);\n        await ensureDraftDbPage(page);\n        const entries = await readDraftEntries(page, draftType);\n        const entry = findDraftEntry(entries, id);\n        if (!entry) throw draftNotFound(id, draftType, 'xiaohongshu/draft-open');\n        const row = normalizeDraftRecord(entry.row, entry.key, draftType, 1, { contentLimit: 500 });\n        return [{\n            id: row.id,\n            type: row.type,\n            title: row.title,\n            updated_at: row.updated_at,\n            images: row.images,\n            content: row.text_preview,\n        }];\n    },\n});\n","sourceCodeStart":14,"sourceCodeEnd":44,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xiaohongshu/draft-open.js#L14-L44","documentation":"draftNotFound is thrown when the requested draft id is absent from the Xiaohongshu draft database entries for the given draft type in the draft-open flow (clis/xiaohongshu/draft-open.js). The command cannot open a draft that doesn't resolve to an entry.","triggerScenarios":"Calling the xiaohongshu draft-open command with an --id not present in readDraftEntries results for the given --type.","commonSituations":"Id taken from an old listing after the draft was deleted or edited; wrong --type passed so lookup misses; draft db page stale or partially loaded; id casing/format mismatch.","solutions":["Run 'opencli xiaohongshu drafts --type <type>' and use a currently listed id","Confirm --type corresponds to the draft's actual kind","Refresh the drafts database page and retry in case entries were stale","Pass the id verbatim from the listing to avoid normalization mismatches"],"exampleFix":"// before\nopencli xiaohongshu draft-open --id draft_123 --type note\n// after\nopencli xiaohongshu drafts --type note\nopencli xiaohongshu draft-open --id <validId> --type note","handlingStrategy":"validation","validationCode":"const drafts = await opencli xiaohongshu drafts --type type;\nif (!drafts.some(d => d.id === targetId)) throw new Error(`Draft ${targetId} not found in ${type} drafts`);","typeGuard":"function draftExists(drafts, id) { return Array.isArray(drafts) && drafts.some(d => d && d.id === id); }","tryCatchPattern":"try {\n  await opencli xiaohongshu draft-open --id id --type type;\n} catch (e) {\n  if (/was not found in .* drafts/.test(e.message)) {\n    const list = await opencli xiaohongshu drafts --type type;\n    // re-select a valid id and retry\n  } else throw e;\n}","preventionTips":["List drafts immediately before opening to get fresh ids","Verify the --type matches the id's collection","Refresh the drafts DB page if listings look stale","Copy ids verbatim from the listing output"],"tags":["not-found","draft","xiaohongshu"],"backgroundTag":"resource-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}