laurent22/joplin · error · Error

Cannot find "%s".

Error message

Cannot find "%s".

What it means

The 'cp' command resolves the destination notebook: either the one named by args['notebook'] via loadItem, or the current folder. If the resolved folder is null it throws 'Cannot find' with the notebook pattern. The message is i18n-translated.

Source

Thrown at packages/app-cli/app/command-cp.ts:24

class Command extends BaseCommand {
	public override usage() {
		return 'cp <note> [notebook]';
	}

	public override description() {
		return _('Duplicates the notes matching <note> to [notebook]. If no notebook is specified the note is duplicated in the current notebook.');
	}

	public override async action(args: { note: string; 'notebook'?: string }) {
		let folder = null;
		if (args['notebook']) {
			folder = await app().loadItem(ModelType.Folder, args['notebook']);
		} else {
			folder = app().currentFolder();
		}

		if (!folder) throw new Error(_('Cannot find "%s".', args['notebook']));

		const notes = await app().loadItems(ModelType.Note, args['note']);
		if (!notes.length) throw new Error(_('Cannot find "%s".', args['note']));

		for (let i = 0; i < notes.length; i++) {
			const newNote = await Note.copyToFolder(notes[i].id, folder.id);
			void Note.updateGeolocation(newNote.id);
		}
	}
}

module.exports = Command;

View on GitHub (pinned to 2654b33620)

Solutions

  1. List notebooks with 'ln' to verify the exact name.
  2. Select the destination with 'use <notebook>' and omit the argument.
  3. Sync to pull missing notebooks.

Example fix

# before
#   joplin cp shopping Work   # 'Work' does not exist
# after
#   joplin cp shopping Worknotebook
Defensive patterns

Strategy: validation

Validate before calling

let folder = args['notebook'] ? await app().loadItem(ModelType.Folder, args['notebook']) : app().currentFolder();
if (!folder) {
  console.error(`Notebook not found: ${args['notebook']}`);
  return;
}

Try / catch

try {
  await command.action(args);
} catch (e) {
  if (/Cannot find/.test(e.message)) console.error(e.message);
}

Prevention

When it happens

Trigger: Running 'cp <note> <notebook>' where <notebook> does not exist, or omitting <notebook> while no notebook is current (currentFolder() returns null).

Common situations: Typo in the notebook name; notebook not synced; notebook deleted; no notebook selected and none specified.

Related errors


AI-assisted analysis of laurent22/joplin@2654b33620 (2026-08-12). Data as JSON: /api/errors/b225616d8e15050e. Report an issue: GitHub.