{"record":{"id":"adb6e17c6e929ad0","repo":"laurent22/joplin","slug":"cannot-find-s-adb6e1","errorCode":null,"errorMessage":"Cannot find \"%s\".","messagePattern":"Cannot find \"(.+?)\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/app-cli/app/command-set.ts","lineNumber":32,"sourceCode":"\t\tconst fields = Note.fields();\n\t\tconst s = [];\n\t\tfor (let i = 0; i < fields.length; i++) {\n\t\t\tconst f = fields[i];\n\t\t\tif (f.name === 'id') continue;\n\t\t\ts.push(`${f.name} (${Database.enumName('fieldType', f.type)})`);\n\t\t}\n\n\t\treturn _('Sets the property <name> of the given <note> to the given [value]. Possible properties are:\\n\\n%s', s.join(', '));\n\t}\n\n\tpublic override async action(args: { note: string; name: string; value?: string }) {\n\t\tconst title = args['note'];\n\t\tconst propName = args['name'];\n\t\tlet propValue = args['value'];\n\t\tif (!propValue) propValue = '';\n\n\t\tconst notes = await app().loadItems(ModelType.Note, title);\n\t\tif (!notes.length) throw new Error(_('Cannot find \"%s\".', title));\n\n\t\tfor (let i = 0; i < notes.length; i++) {\n\t\t\tthis.encryptionCheck(notes[i]);\n\n\t\t\tconst timestamp = Date.now();\n\n\t\t\tconst newNote: Record<string, unknown> = {\n\t\t\t\tid: notes[i].id,\n\t\t\t\ttype_: notes[i].type_,\n\t\t\t\tupdated_time: timestamp,\n\t\t\t};\n\t\t\tnewNote[propName] = propValue;\n\n\t\t\tif (!newNote.id) newNote.created_time = timestamp;\n\n\t\t\tawait Note.save(newNote, {\n\t\t\t\tautoTimestamp: false, // No auto-timestamp because user may have provided them\n\t\t\t});","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/laurent22/joplin/blob/2654b33620775080d1d59c552259d41e33dad3d2/packages/app-cli/app/command-set.ts#L14-L50","documentation":"Thrown by the `set` command when `app().loadItems(ModelType.Note, title)` returns an empty array, meaning no note matches the supplied title pattern. The command edits a named property on each matched note, so zero matches is a hard stop. `%s` is replaced with the requested note title so the user can see what failed to resolve.","triggerScenarios":"Running `:set <note> <name> [value]` where `<note>` does not match any Note.title (loadItems matches by title or id pattern). Also when the note exists but is inside an encrypted notebook whose title has not been decrypted yet, so the plaintext title is unknown to the loader.","commonSituations":"Mistyped note title; note was deleted or moved off-profile; E2EE-encrypted notes whose titles are still ciphertext; title pattern that is a partial match the loader does not accept.","solutions":["List notes with `:ls` or `find <pattern>` to copy the exact title, then re-run `:set`.","If the notebook is encrypted, run `:e2ee decrypt` to supply the password and decrypt titles first.","Pass the note id instead of the title if the title is ambiguous or hard to type.","Verify you are in the right profile (`--profile`) that actually contains the note."],"exampleFix":"// before\nconst notes = await app().loadItems(ModelType.Note, title);\nif (!notes.length) throw new Error(_('Cannot find \"%s\".', title));\n\n// after - also accept an explicit id and give a clearer message\nconst notes = await app().loadItems(ModelType.Note, title);\nif (!notes.length) throw new Error(_('Cannot find note \"%s\". Use `:ls` to list note titles.', title));","handlingStrategy":"validation","validationCode":"const notes = await app().loadItems(ModelType.Note, title);\nif (!notes.length) {\n\tthrow new Error(`No note matches \"${title}\". Use the note id or run \\`:ls\\`.`);\n}","typeGuard":"const hasMatch = <T>(arr: T[]): arr is T[] => Array.isArray(arr) && arr.length > 0;","tryCatchPattern":"try {\n\tawait app().executeCommand(['set', noteTitle, propName, value]);\n} catch (e) {\n\tif (/Cannot find/.test(e.message)) { /* re-list notes / decrypt titles */ }\n\telse throw e;\n}","preventionTips":["Prefer note ids over titles in scripts to avoid ambiguity.","Decrypt E2EE notebook titles before referencing them.","Confirm the profile contains the note before scripting bulk edits."],"tags":["note","set","property","cli","not-found","e2ee"],"backgroundTag":null,"analyzedSha":"2654b33620775080d1d59c552259d41e33dad3d2","analyzedAt":"2026-08-12T14:26:46.263Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}