{"record":{"id":"93973b5842d742ab","repo":"laurent22/joplin","slug":"cannot-find-s-93973b","errorCode":null,"errorMessage":"Cannot find \"%s\".","messagePattern":"Cannot find \"(.+?)\"\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/app-cli/app/command-done.ts","lineNumber":21,"sourceCode":"import { _ } from '@joplin/lib/locale';\nimport { ModelType } from '@joplin/lib/BaseModel';\nimport Note from '@joplin/lib/models/Note';\nimport time from '@joplin/lib/time';\nimport { NoteEntity } from '@joplin/lib/services/database/types';\n\nclass Command extends BaseCommand {\n\tpublic override usage() {\n\t\treturn 'done <note>';\n\t}\n\n\tpublic override description() {\n\t\treturn _('Marks a to-do as done.');\n\t}\n\n\tpublic static async handleAction(commandInstance: BaseCommand, args: { note: string }, isCompleted: boolean) {\n\t\tconst note: NoteEntity = await app().loadItem(ModelType.Note, args.note);\n\t\tcommandInstance.encryptionCheck(note);\n\t\tif (!note) throw new Error(_('Cannot find \"%s\".', args.note));\n\t\tif (!note.is_todo) throw new Error(_('Note is not a to-do: \"%s\"', args.note));\n\n\t\tconst todoCompleted = !!note.todo_completed;\n\n\t\tif (isCompleted === todoCompleted) return;\n\n\t\tawait Note.save({\n\t\t\tid: note.id,\n\t\t\ttodo_completed: isCompleted ? time.unixMs() : 0,\n\t\t});\n\t}\n\n\tpublic override async action(args: { note: string }) {\n\t\tawait Command.handleAction(this, args, true);\n\t}\n}\n\nmodule.exports = Command;","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/laurent22/joplin/blob/2654b33620775080d1d59c552259d41e33dad3d2/packages/app-cli/app/command-done.ts#L3-L39","documentation":"The 'done' command loads the note via app().loadItem, runs encryptionCheck, then checks for null and throws 'Cannot find' if the note does not exist. The message is i18n-translated.","triggerScenarios":"Running 'done <note>' where <note> matches no note title or id in the current notebook.","commonSituations":"Typo in the title; note in a different notebook; note not synced; note deleted.","solutions":["Verify the title/id with 'ls'.","Switch notebooks with 'use <notebook>'.","Sync to pull missing notes.","Use the note id if the title is ambiguous."],"exampleFix":"# before\n#   joplin done task42   # does not exist\n# after\n#   joplin done \"task 42\"","handlingStrategy":"validation","validationCode":"const note = await app().loadItem(ModelType.Note, args.note);\nif (!note) {\n  console.error(`Note not found: ${args.note}`);\n  return;\n}","typeGuard":null,"tryCatchPattern":"try {\n  await Command.handleAction(this, args, isCompleted);\n} catch (e) {\n  if (/Cannot find/.test(e.message)) console.error(e.message);\n}","preventionTips":["Confirm the note title/id with 'ls' before 'done'.","Ensure the correct notebook is current with 'use'.","Verify the note is a todo (is_todo) before toggling."],"tags":["cli","done-command","todo","item-lookup","i18n"],"backgroundTag":null,"analyzedSha":"2654b33620775080d1d59c552259d41e33dad3d2","analyzedAt":"2026-08-12T14:26:46.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}