jackwener/OpenCLI · warning · EmptyResultError

opencli notebooklm open

Error message

opencli notebooklm open

What it means

`opencli notebooklm open` throws this EmptyResultError when navigation succeeded far enough that the page reports kind 'notebook' (passing the CliError guard), but readCurrentNotebooklm could not extract the notebook's metadata after navigation. The notebook is open; its id/title block just could not be scraped.

Source

Thrown at clis/notebooklm/open.js:38

            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. Retry after a short delay so the notebook metadata finishes rendering (increase the post-navigation wait).
  2. Run `opencli notebooklm get` after a successful-looking `open` to test metadata extraction directly.
  3. Update opencli if the NotebookLM header DOM changed.
  4. Retry `open` with a plain notebook id instead of a URL if the URL path parsing differs.

Example fix

// before
opencli notebooklm open <id>   # metadata scrape raced the render
// after
opencli notebooklm open <id>
sleep 3
opencli notebooklm get
Defensive patterns

Strategy: retry

Validate before calling

const out = await run(`opencli notebooklm open ${id} -f json`).catch(() => null);
if (!out || !out[0] || !out[0].id) {
  await new Promise(r => setTimeout(r, 3000));
  await run(`opencli notebooklm get -f json`);
}

Type guard

function hasOpenedMetadata(result) {
  return Array.isArray(result) && result.length > 0 && typeof result[0].title === 'string';
}

Try / catch

try {
  opened = await run(`opencli notebooklm open ${id} -f json`);
} catch (e) {
  if (String(e.message).includes('metadata was not found after navigation')) {
    await sleep(3000);
    opened = await run(`opencli notebooklm get -f json`); // re-read metadata
  } else throw e;
}

Prevention

When it happens

Trigger: state.kind === 'notebook' but readCurrentNotebooklm(page) returns null — title header not yet rendered after the fixed page.wait(2), DOM structure change in the notebook header/metadata area, or the page is a notebook-shaped error/limited view.

Common situations: Slow network leaving the notebook shell rendered but metadata missing at scrape time; NotebookLM UI update changing metadata selectors; regional/experimental UI variants.

Related errors


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