{"record":{"id":"3876a1b931d8eaa1","repo":"jackwener/OpenCLI","slug":"source-query-was-not-found-in-the-current-not-3876a1","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-get.js","lineNumber":38,"sourceCode":"        },\n    ],\n    columns: ['title', 'id', 'type', 'size', 'created_at', 'updated_at', 'url', '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-get', '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-get', '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            return [matched];\n        throw new EmptyResultError('opencli notebooklm source-get', `Source \"${query}\" was not found in the current notebook.`);\n    },\n});\n","sourceCodeStart":20,"sourceCodeEnd":41,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/notebooklm/source-get.js#L20-L41","documentation":"opencli notebooklm source-get throws this EmptyResultError when a notebook is open, sources were listed, but findNotebooklmSourceRow could not match the --source argument (stringified from kwargs.source) against any row's title or id. It means the query resolved to zero rows.","triggerScenarios":"`opencli notebooklm source-get <notebook> --source \"name\"` where no listed source's title or id matches the query string (typo, stale title, partial match not supported, or passing a URL/filename instead of the listed title).","commonSituations":"Typo or different casing than the source title in NotebookLM; referencing a source that was deleted or renamed; quoting the local file path instead of the source title shown in the notebook; passing a source id from an old listing after the notebook changed.","solutions":["Run `opencli notebooklm source-list` and copy the exact title/id of the target source.","Correct the --source value (exact title or id as listed) and retry.","If the source was deleted or renamed, re-add it or update the reference."],"exampleFix":"// before\nopencli notebooklm source-get --source \"my report.pdf\"\n// after\nopencli notebooklm source-list            # shows: \"My Report (Final).pdf\"\nopencli notebooklm source-get --source \"My Report (Final).pdf\"","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(`No source matching \"${wanted}\"; run source-list for exact titles/ids`);","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-get', ['--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":["Always resolve names via source-list instead of hardcoding titles.","Use source ids (stable) rather than display titles in scripts.","Re-list sources after add/delete/rename operations.","Normalize casing/whitespace when matching titles yourself."],"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"}