laurent22/joplin · error · Error

No active notebook.

Error message

No active notebook.

What it means

Thrown by the `edit <note>` command when `app().currentFolder()` returns a falsy value. `currentFolder_` is only populated from `Setting.value('activeFolderId')` during CLI startup (app.ts:415-416) or via `switchCurrentFolder`; on a fresh profile, a deleted-last-notebook state, or an empty `activeFolderId`, it stays null. The check fires before `loadItem`, so note lookup is never attempted.

Source

Thrown at packages/app-cli/app/command-edit.ts:40

		const onFinishedEditing = async () => {
			if (tempFilePath) fs.removeSync(tempFilePath);
		};

		const textEditorPath = () => {
			if (Setting.value('editor')) return Setting.value('editor');
			if (process.env.EDITOR) return process.env.EDITOR;
			throw new Error(_('No text editor is defined. Please set it using `config editor <editor-path>`'));
		};

		try {
			// -------------------------------------------------------------------------
			// Load note or create it if it doesn't exist
			// -------------------------------------------------------------------------

			const title = args['note'];

			if (!app().currentFolder()) throw new Error(_('No active notebook.'));
			let note = await app().loadItem(ModelType.Note, title);

			this.encryptionCheck(note);

			if (!note) {
				const ok = await this.prompt(_('Note does not exist: "%s". Create it?', title));
				if (!ok) return;
				note = await Note.save({ title: title, parent_id: app().currentFolder().id });
				note = await Note.load(note.id);
			}

			// -------------------------------------------------------------------------
			// Create the file to be edited and prepare the editor program arguments
			// -------------------------------------------------------------------------

			let editorPath = textEditorPath();
			let editorArgs = splitCommandString(editorPath);

View on GitHub (pinned to 2654b33620)

Solutions

  1. Create a notebook first: `joplin mkbook MyNotes`, then select it: `joplin use MyNotes`
  2. Verify a notebook is active by running `joplin ls /` and checking the highlighted/selected entry, or inspect `Setting.value('activeFolderId')`
  3. If a notebook exists but isn't selected, run `joplin use <notebook-title-or-id>` (use short id from `ti`)
  4. If profile is corrupted, check `~/.config/joplin-dev-desktop/settings.json` `activeFolderId` and reset it to a valid folder id

Example fix

// before
joplin edit "Shopping List"   // throws: No active notebook.

// after
joplin mkbook Personal
joplin use Personal
joplin edit "Shopping List"
Defensive patterns

Strategy: validation

Validate before calling

import app from './app';
import { Setting } from '@joplin/lib/models';

// run before invoking edit
function hasActiveNotebook(): boolean {
  return !!app().currentFolder();
}

// or, from outside the app process, check the persisted setting:
function activeFolderIdValid(): boolean {
  return !!Setting.value('activeFolderId');
}

if (!hasActiveNotebook()) {
  console.error('No active notebook. Run `mkbook <name>` then `use <name>` first.');
  process.exit(1);
}

Type guard

import { FolderEntity } from '@joplin/lib/services/database/types';

const isActiveNotebook = (f: FolderEntity | null): f is FolderEntity =>
  f !== null && typeof f.id === 'string' && f.id.length > 0;

// usage
const folder = app().currentFolder();
if (!isActiveNotebook(folder)) {
  throw new Error('precondition: active notebook required');
}

Prevention

When it happens

Trigger: Running `joplin edit <title>` (or the GUI `edit` action) against a profile where `activeFolderId` is empty, references a notebook that no longer exists, or when every notebook has been deleted/moved to trash. Also reachable right after `joplin use <bad-id>` fails silently to switch.

Common situations: Fresh Joplin profile with no notebooks created yet; after deleting all notebooks; after switching profiles via `--profile` to an empty one; running edit before ever calling `mkbook`/`use`.

Related errors


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