jackwener/OpenCLI · error · EmptyResultError

notebooklm generate-audio

Error message

notebooklm generate-audio

What it means

This EmptyResultError is thrown by `notebooklm generate-audio` when the notebook loaded successfully but `listNotebooklmSourcesViaRpc` returned zero usable source ids. Audio overviews require at least one source, so the library refuses to call the CreateAudioOverview RPC.

Solutions

  1. Add at least one source to the notebook in NotebookLM (upload a file, paste a link, or add a note).
  2. Re-run `opencli notebooklm generate-audio` after sources are present.
  3. If sources exist but ids come back empty, retry later — sources may still be processing.

Example fix

// before
opencli notebooklm generate-audio --notebook <empty-notebook>
// after
opencli notebooklm add-source --notebook <id> --file report.pdf
opencli notebooklm generate-audio --notebook <id>
Defensive patterns

Strategy: validation

Validate before calling

const sources = await runCli(['notebooklm', 'sources', '--notebook', notebookId]);
if (!sources.length) throw new Error('notebook has no sources; add one before generating audio');

Type guard

const hasSources = (sources) => Array.isArray(sources) && sources.some((s) => typeof s?.id === 'string' && s.id);

Try / catch

try {
  await generateAudio({ notebookId });
} catch (e) {
  if (String(e.message).includes('notebooklm generate-audio') && String(e.message).includes('no sources')) {
    throw new Error('Precondition failed: add sources to the notebook first');
  }
  throw e;
}

Prevention

When it happens

Trigger: Running generate-audio against an empty notebook (no sources added), or when the sources-list RPC fails to surface any string ids.

Common situations: User created a notebook and immediately tried audio generation without adding PDFs/links/notes; notebook freshly duplicated with sources still processing.

Related errors


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

Appendix: source

Thrown at clis/notebooklm/generate-audio.js:74

        { name: 'notebook', positional: true, required: true, help: 'Notebook id from `notebooklm list` or full notebook URL' },
        { name: 'execute', type: 'boolean', help: 'Actually trigger remote NotebookLM audio generation' },
    ],
    columns: ['notebook_id', 'audio_id', 'source_count', 'status', 'notebook_url'],
    func: async (page, kwargs) => {
        const notebookId = parseNotebooklmNotebookTarget(String(kwargs.notebook ?? ''));
        requireNotebooklmExecute(kwargs.execute, 'generate NotebookLM audio');
        try {
            await page.goto(buildNotebooklmNotebookUrl(notebookId));
            await page.wait(2);
        }
        catch (error) {
            throw new CommandExecutionError(`Failed to open NotebookLM notebook ${notebookId}: ${error?.message || error}`);
        }
        await requireNotebooklmSession(page);
        const sources = await listNotebooklmSourcesViaRpc(page);
        const sourceIds = sources.map((s) => s.id).filter((id) => typeof id === 'string' && id);
        if (sourceIds.length === 0) {
            throw new EmptyResultError('notebooklm generate-audio', 'The notebook has no sources; add a source before generating an audio overview.');
        }
        const rpc = await callNotebooklmRpc(page, NOTEBOOKLM_CREATE_AUDIO_RPC_ID, buildCreateAudioArgs(notebookId, sourceIds));
        const audioId = parseAudioIdFromResult(rpc.result, [notebookId, ...sourceIds]);
        if (!audioId) {
            throw new CommandExecutionError('NotebookLM CreateAudioOverview RPC returned no audio id; server may have rejected the request.');
        }
        return [{
            notebook_id: notebookId,
            audio_id: audioId,
            source_count: sourceIds.length,
            status: 'pending',
            notebook_url: buildNotebooklmNotebookUrl(notebookId),
        }];
    },
});

export const __test__ = { AUDIO_OVERVIEW_CONFIG_BLOCK, buildCreateAudioArgs, parseAudioIdFromResult };

View on GitHub (pinned to 49907e53dc)