jackwener/OpenCLI · error · CliError

NOTEBOOKLM_OPEN_FAILED

NOTEBOOKLM_OPEN_FAILED

Error message

NOTEBOOKLM_OPEN_FAILED

What it means

`opencli notebooklm open <notebook>` throws this CliError with code NOTEBOOKLM_OPEN_FAILED when, after navigating to the built notebook URL and waiting, the page state is still not kind 'notebook' — i.e. NotebookLM did not actually open the requested notebook in the adapter session. The suggested remediation is embedded in the error: get a valid id from `notebooklm list`.

Source

Thrown at clis/notebooklm/open.js:31

    browser: true,
    navigateBefore: false,
    args: [
        {
            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. Run `opencli notebooklm list -f json` and pass an id exactly as listed.
  2. Verify the notebook still exists and your account has access at notebooklm.google.com.
  3. Re-authenticate the browser session if navigation redirects to a sign-in page.
  4. If passing a URL, ensure it is a full NotebookLM notebook URL for the same account/domain.

Example fix

// before
opencli notebooklm open abc12   # truncated id -> NOTEBOOKLM_OPEN_FAILED
// after
opencli notebooklm list -f json
opencli notebooklm open abc123def456-full-id
Defensive patterns

Strategy: validation

Validate before calling

const notebooks = await run('opencli notebooklm list -f json');
const valid = notebooks.some(n => n.id === notebookId || n.url === notebookId);
if (!valid) throw new Error(`Invalid notebook target: ${notebookId}`);

Type guard

function isValidNotebookTarget(target, notebooks) {
  return notebooks.some(n => n.id === target || n.url === target);
}

Try / catch

try {
  await run(`opencli notebooklm open "${id}" -f json`);
} catch (e) {
  if (e.code === 'NOTEBOOKLM_OPEN_FAILED' || String(e.message).includes('did not open')) {
    const list = await run('opencli notebooklm list -f json');
    throw new Error(`Notebook ${id} unavailable. Known ids: ${list.map(n => n.id).join(', ')}`);
  } else throw e;
}

Prevention

When it happens

Trigger: parseNotebooklmNotebookTarget produced an id (valid or not) whose notebook URL loaded something other than the notebook view: nonexistent/deleted notebook id, malformed id or URL, redirect to sign-in/error page, or a notebook the account cannot access.

Common situations: Hallucinated or copy-paste-truncated notebook id; notebook deleted by a teammate; sharing permission revoked; passing a URL from a different domain/account; expired session redirecting to login instead of the notebook.

Related errors


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