laurent22/joplin · error · Error
Cannot find "%s".
Error message
Cannot find "%s".
What it means
Thrown by the `use` CLI command when app().loadItem(ModelType.Folder, args.notebook) returns null — i.e. no notebook (folder) matches the given name or ID. Once switched, all subsequent CLI operations are scoped to that notebook, so the lookup must succeed.
Source
Thrown at packages/app-cli/app/command-use.ts:22
import { ModelType } from '@joplin/lib/BaseModel';
import Folder from '@joplin/lib/models/Folder';
class Command extends BaseCommand {
public override usage() {
return 'use <notebook>';
}
public override description() {
return _('Switches to [notebook] - all further operations will happen within this notebook.');
}
public override compatibleUis() {
return ['cli'];
}
public override async action(args: { 'notebook': string }) {
const folder = await app().loadItem(ModelType.Folder, args['notebook']);
if (!folder) throw new Error(_('Cannot find "%s".', args['notebook']));
// Auto-expand parent folders in GUI if present
if (app().gui() && app().gui().widget && app().gui().widget('folderList')) {
const folderListWidget = app().gui().widget('folderList');
if (folderListWidget.expandToFolder) {
// Get all folders to pass to expandToFolder
const folders = await Folder.all();
folderListWidget.folders = folders; // Ensure widget has current folders
folderListWidget.expandToFolder(folder.id);
}
}
app().switchCurrentFolder(folder);
}
}
module.exports = Command;
View on GitHub (pinned to 2654b33620)
Solutions
- List notebooks with `ln` (the folder-list CLI command) to confirm the exact name or ID.
- Use the notebook ID instead of its display name.
- Check the active profile/database if the notebook is expected to exist.
- Sync to pull notebook changes from other clients.
Example fix
// before
const folder = await app().loadItem(ModelType.Folder, args['notebook']);
if (!folder) throw new Error(_('Cannot find "%s".', args['notebook']));
// after
const folder = await app().loadItem(ModelType.Folder, args['notebook']);
if (!folder) throw new Error(_('Cannot find notebook "%s". Run `ln` to list notebooks.', args['notebook'])); Defensive patterns
Strategy: validation
Validate before calling
const folder = await Folder.load(notebookNameOrId);
if (!folder) {
console.error(`Notebook "${notebookNameOrId}" not found. Run 'ln' to list.`);
return;
}
await command.exec(['use', notebookNameOrId]); Type guard
function folderExists(folder: FolderEntity | null): folder is FolderEntity {
return folder != null && typeof folder.id === 'string';
} Try / catch
try {
await command.exec(['use', notebook]);
} catch (e) {
if (e.message.startsWith('Cannot find')) {
// list notebooks and prompt the user to pick
} else throw e;
} Prevention
- List notebooks (`ln`) and copy the exact name or ID before calling `use`.
- Use IDs rather than display names to avoid rename/encoding issues.
- Sync first if notebooks may have changed on other devices.
When it happens
Trigger: Running `use <notebook>` where <notebook> matches no folder by name or ID. loadItem resolves against the folder table; a miss returns null and the guard throws.
Common situations: Typo in notebook name; the notebook was deleted or renamed; using a notebook ID from a different profile; confusion between a notebook and a tag.
Related errors
- Cannot find "%s".
- Cannot find: "%s"
- Ambiguous notebook "%s". Please use short notebook id instea
- Cannot find "%s".
- Ambiguous notebook "%s". Please use short notebook id instea
AI-assisted analysis of laurent22/joplin@2654b33620 (2026-08-12).
Data as JSON: /api/errors/d83c5f28199821e1.
Report an issue: GitHub.