jackwener/OpenCLI · warning

[notebooklm open] expected notebook "${notebookId}" but page

Error message

[notebooklm open] expected notebook "${notebookId}" but page reports "${state.notebookId}"; continuing

What it means

After navigating to a NotebookLM notebook, the page state reports a different notebook id than the one requested. The library only warns and continues, because the page did open a valid notebook — the id mismatch may come from redirects, id normalization, or stale client state.

Source

Thrown at clis/notebooklm/open.js:34

        {
            name: 'notebook',
            positional: true,
            required: true,
            help: 'Notebook id from list output, or a full NotebookLM notebook URL',
        },
    ],
    columns: ['id', 'title', 'url', 'source'],
    func: async (page, kwargs) => {
        const notebookId = parseNotebooklmNotebookTarget(String(kwargs.notebook ?? ''));
        await page.goto(buildNotebooklmNotebookUrl(notebookId));
        await page.wait(2);
        await requireNotebooklmSession(page);
        const state = await getNotebooklmPageState(page);
        if (state.kind !== 'notebook') {
            throw new CliError('NOTEBOOKLM_OPEN_FAILED', `NotebookLM notebook "${notebookId}" did not open in the adapter session`, 'Run `opencli notebooklm list -f json` first and pass a valid notebook id.');
        }
        if (state.notebookId !== notebookId) {
            console.warn(`[notebooklm open] expected notebook "${notebookId}" but page reports "${state.notebookId}"; continuing`);
        }
        const current = await readCurrentNotebooklm(page);
        if (!current) {
            throw new EmptyResultError('opencli notebooklm open', 'NotebookLM notebook metadata was not found after navigation.');
        }
        return [current];
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Confirm the id with `opencli notebooklm list -f json` and pass the exact current id
  2. Re-run the open command — transient redirects sometimes resolve correctly on retry
  3. Check whether the requested notebook still exists or was merged/renamed; a wrong id may now point elsewhere
  4. If the mismatch is benign (alias/canonical id), ignore the warning since metadata is still read from the live page

Example fix

// before
opencli notebooklm open nb-OLD-ALIAS
// after: use canonical id from list
opencli notebooklm list -f json
opencli notebooklm open nb-CANONICAL-ID
Defensive patterns

Strategy: validation

Validate before calling

const listed = await run('opencli notebooklm list -f json');
const valid = JSON.parse(listed).some(n => n.id === notebookId);
if (!valid) throw new Error(`Unknown notebook id: ${notebookId}`);

Type guard

const isSameNotebook = (state, id) => state.kind === 'notebook' && state.notebookId === id;

Try / catch

try {
  await opencliNotebooklmOpen(notebookId);
} catch (err) {
  if (err.code === 'NOTEBOOKLM_OPEN_FAILED') { /* re-list notebooks and retry with canonical id */ }
}

Prevention

When it happens

Trigger: opencli notebooklm open <id> navigates, requireNotebooklmSession and getNotebooklmPageState succeed with kind 'notebook', but state.notebookId !== notebookId.

Common situations: NotebookLM redirecting to a canonical/different notebook URL, passing a truncated or URL-decoded variant of the id, sharing links resolving to an alias notebook, recent id format change on NotebookLM's side.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/b1886e722a276310. Report an issue: GitHub.