{"record":{"id":"7f9508ee582c16c4","repo":"jackwener/OpenCLI","slug":"source-query-was-not-found-in-the-current-not-7f9508","errorCode":null,"errorMessage":"Source \"${query}\" was not found in the current notebook.","messagePattern":"Source \"(.+?)\" was not found in the current notebook\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/notebooklm/source-guide.js","lineNumber":37,"sourceCode":"            help: 'Source id or title from the current notebook',\n        },\n    ],\n    columns: ['source_id', 'notebook_id', 'title', 'type', 'summary', 'keywords', 'source'],\n    func: async (page, kwargs) => {\n        await requireNotebooklmSession(page);\n        const state = await getNotebooklmPageState(page);\n        if (state.kind !== 'notebook') {\n            throw new EmptyResultError('opencli notebooklm source-guide', 'No NotebookLM notebook is open in the adapter session. Run `opencli notebooklm open <notebook>` first.');\n        }\n        const rpcRows = await listNotebooklmSourcesViaRpc(page).catch(() => []);\n        const rows = rpcRows.length > 0 ? rpcRows : await listNotebooklmSourcesFromPage(page);\n        if (rows.length === 0) {\n            throw new EmptyResultError('opencli notebooklm source-guide', 'No NotebookLM sources were found on the current page.');\n        }\n        const query = typeof kwargs.source === 'string' ? kwargs.source : String(kwargs.source ?? '');\n        const matched = findNotebooklmSourceRow(rows, query);\n        if (!matched) {\n            throw new EmptyResultError('opencli notebooklm source-guide', `Source \"${query}\" was not found in the current notebook.`);\n        }\n        const guide = await getNotebooklmSourceGuideViaRpc(page, matched).catch(() => null);\n        if (guide)\n            return [guide];\n        throw new EmptyResultError('opencli notebooklm source-guide', `NotebookLM guide was not available for source \"${matched.title}\".`);\n    },\n});\n","sourceCodeStart":19,"sourceCodeEnd":45,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/notebooklm/source-guide.js#L19-L45","documentation":"opencli notebooklm source-guide throws this EmptyResultError when the notebook and sources are fine, but findNotebooklmSourceRow found no row matching the --source argument. The query stringified from kwargs.source matched zero listed sources.","triggerScenarios":"`opencli notebooklm source-guide --source \"title\"` where no source title or id matches the provided string: typo, renamed/deleted source, or passing a file path/URL instead of the listed title.","commonSituations":"Casing or wording differs from the NotebookLM source title; source removed since the last listing; using an id from a different notebook; quotes/spaces mismatch.","solutions":["Run `opencli notebooklm source-list` to get exact source titles/ids.","Retry with the exact title or id from the listing.","Re-add the source if it was deleted; update scripts to reference the current title."],"exampleFix":"// before\nopencli notebooklm source-guide --source \"report\"\n// after\nopencli notebooklm source-list              # exact title: \"Q3 Report\"\nopencli notebooklm source-guide --source \"Q3 Report\"","handlingStrategy":"validation","validationCode":"const sources = await exec('opencli notebooklm source-list --json');\nconst hit = sources.find(s => s.title === wanted || s.id === wanted);\nif (!hit) throw new Error(`Source \"${wanted}\" not found; check source-list`);","typeGuard":"function findSourceRow(rows, query) {\n  if (!Array.isArray(rows) || typeof query !== 'string') return null;\n  const q = query.trim().toLowerCase();\n  return rows.find(r => r?.title?.toLowerCase() === q || r?.id === query) ?? null;\n}","tryCatchPattern":"try {\n  return await run('opencli notebooklm source-guide', ['--source', name]);\n} catch (err) {\n  if (/was not found in the current notebook/.test(err.message)) {\n    const rows = await run('opencli notebooklm source-list');\n    throw new Error(`\"${name}\" not found. Available: ${rows.map(r => r.title).join(', ')}`);\n  }\n  throw err;\n}","preventionTips":["Look up exact titles via source-list before guide requests.","Prefer source ids over titles in automation.","Refresh listings after renaming or deleting sources.","Trim/normalize query strings to avoid whitespace mismatches."],"tags":["notebooklm","lookup-failed","empty-result"],"backgroundTag":"notebooklm-source-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}