{"record":{"id":"727c0b633fcfb1df","repo":"laurent22/joplin","slug":"ambiguous-notebook-s-please-use-short-notebook-727c0b","errorCode":null,"errorMessage":"Ambiguous notebook \"%s\". Please use short notebook id instead - press \"ti\" to see the short notebook id","messagePattern":"Ambiguous notebook \"(.+?)\"\\. Please use short notebook id instead - press \"ti\" to see the short notebook id","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/app-cli/app/command-mv.ts","lineNumber":29,"sourceCode":"\t}\n\n\tpublic override description() {\n\t\treturn _('Moves the given <item> to [notebook]');\n\t}\n\n\tpublic override async action(args: { item: string; 'notebook': string }) {\n\t\tconst pattern = args['item'];\n\t\tconst destination = args['notebook'];\n\t\tlet folder = null;\n\n\t\tif (destination !== 'root') {\n\t\t\tfolder = await app().loadItem(ModelType.Folder, destination);\n\t\t\tif (!folder) throw new Error(_('Cannot find \"%s\".', destination));\n\t\t}\n\n\t\tconst destinationDuplicates = await Folder.search({ titlePattern: destination, limit: 2 });\n\t\tif (destinationDuplicates.length > 1) {\n\t\t\tthrow new Error(_('Ambiguous notebook \"%s\". Please use short notebook id instead - press \"ti\" to see the short notebook id', destination));\n\t\t}\n\n\t\tconst itemFolder = await app().loadItem(ModelType.Folder, pattern);\n\t\tif (itemFolder) {\n\t\t\tconst sourceDuplicates = await Folder.search({ titlePattern: pattern, limit: 2 });\n\t\t\tif (sourceDuplicates.length > 1) {\n\t\t\t\tthrow new Error(_('Ambiguous notebook \"%s\". Please use notebook id instead - press \"ti\" to see the short notebook id or use $b for current selected notebook', pattern));\n\t\t\t}\n\t\t\tif (destination === 'root') {\n\t\t\t\tawait Folder.moveToFolder(itemFolder.id, '');\n\t\t\t} else {\n\t\t\t\tawait Folder.moveToFolder(itemFolder.id, folder.id);\n\t\t\t}\n\t\t} else {\n\t\t\tconst notes = await app().loadItems(ModelType.Note, pattern);\n\t\t\tif (notes.length === 0) throw new Error(_('Cannot find \"%s\".', pattern));\n\t\t\tfor (let i = 0; i < notes.length; i++) {\n\t\t\t\tawait Note.moveToFolder(notes[i].id, folder.id);","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/laurent22/joplin/blob/2654b33620775080d1d59c552259d41e33dad3d2/packages/app-cli/app/command-mv.ts#L11-L47","documentation":"Thrown by `mv <item> <notebook>` when the destination was found by loadItem but `Folder.search({ titlePattern: destination, limit: 2 })` returns >1 row. Same LIKE-matching ambiguity as mkbook's validDestinationFolder: the destination string is a substring of multiple notebook titles, so the move target is ambiguous even though an exact match exists.","triggerScenarios":"Destination name LIKE-matches several notebooks (e.g., `mv Note X` when \"Notes\" and \"My Notes\" both exist); short destination strings; overlapping names in a large catalog.","commonSituations":"Notebook tree with similarly-named folders; abbreviated destination references in batch scripts.","solutions":["Use the short notebook id: `joplin mv <item> <short-id>`","Rename colliding notebooks to disambiguate","Use the full 32-char folder id"],"exampleFix":"// before\njoplin mv mynote Note   // Note LIKE-matches \"Notes\" + \"My Notes\" -> throws\n\n// after\njoplin mv mynote 7f3a    // short id","handlingStrategy":"validation","validationCode":"import Folder from '@joplin/lib/models/Folder';\n\nasync function assertDestinationUnambiguous(destRef: string) {\n  const dups = await Folder.search({ titlePattern: destRef, limit: 2 });\n  if (dups.length > 1) {\n    throw new Error(`Destination \"${destRef}\" is ambiguous. Use the short notebook id.`);\n  }\n}","typeGuard":"const isUnambiguous = async (ref: string): Promise<boolean> =>\n  (await Folder.search({ titlePattern: ref, limit: 2 })).length <= 1;","tryCatchPattern":null,"preventionTips":["Use short notebook ids for destinations whenever titles overlap","Rename colliding notebooks to disambiguate","Avoid overly short destination names in large catalogs"],"tags":["cli","mv","notebook-lookup","ambiguous","validation"],"backgroundTag":null,"analyzedSha":"2654b33620775080d1d59c552259d41e33dad3d2","analyzedAt":"2026-08-12T14:26:46.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}