laurent22/joplin · error · Error

Cannot find "%s".

Error message

Cannot find "%s".

What it means

The 'attach' command loads the target note by title via app().loadItem scoped to the current notebook, runs encryptionCheck, then checks for null and throws 'Cannot find' if the note does not exist. The message is i18n-translated.

Source

Thrown at packages/app-cli/app/command-attach.ts:21

import { _ } from '@joplin/lib/locale';
import { ModelType } from '@joplin/lib/BaseModel';
import shim from '@joplin/lib/shim';

class Command extends BaseCommand {
	public override usage() {
		return 'attach <note> <file>';
	}

	public override description() {
		return _('Attaches the given file to the note.');
	}

	public override async action(args: { note: string; file: string }) {
		const title = args['note'];

		const note = await app().loadItem(ModelType.Note, title, { parent: app().currentFolder() });
		this.encryptionCheck(note);
		if (!note) throw new Error(_('Cannot find "%s".', title));

		const localFilePath = args['file'];

		await shim.attachFileToNote(note, localFilePath);
	}
}

module.exports = Command;

View on GitHub (pinned to 2654b33620)

Solutions

  1. Verify the exact title/id with 'ls'.
  2. Switch to the correct notebook with 'use <notebook>'.
  3. Sync to pull missing notes.
  4. Use the note id if the title is ambiguous.

Example fix

# before
#   joplin attach "shoping" list.txt   # typo -> Cannot find
# after
#   joplin attach "shopping" list.txt
Defensive patterns

Strategy: validation

Validate before calling

const note = await app().loadItem(ModelType.Note, title, { parent: app().currentFolder() });
if (!note) {
  console.error(`Note not found: ${title}`);
  return;
}

Try / catch

try {
  await shim.attachFileToNote(note, localFilePath);
} catch (e) {
  if (/Cannot find/.test(e.message)) console.error(e.message);
}

Prevention

When it happens

Trigger: Running 'attach <note> <file>' where <note> does not match any note title or id in the current notebook.

Common situations: Typo in the note title; note is in a different notebook than the current one; note not yet synced; note was deleted.

Related errors


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