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
- Create a notebook first: `joplin mkbook MyNotes`, then select it: `joplin use MyNotes`
- Verify a notebook is active by running `joplin ls /` and checking the highlighted/selected entry, or inspect `Setting.value('activeFolderId')`
- If a notebook exists but isn't selected, run `joplin use <notebook-title-or-id>` (use short id from `ti`)
- 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
- In setup scripts, always call `mkbook` + `use` before any note-editing command
- After `joplin use <id>`, verify selection by running `joplin ls` (lists notes) rather than `joplin ls /`
- Reset `activeFolderId` whenever you reset/restore the profile DB
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
- Notes can only be created within a notebook.
- Notes can only be created within a notebook.
- No notebook selected.
- No notebook has been specified.
- Cannot find "%s".
AI-assisted analysis of laurent22/joplin@2654b33620 (2026-08-12).
Data as JSON: /api/errors/f513a09bf4e87720.
Report an issue: GitHub.