{"record":{"id":"831e61625fc7ccbf","repo":"jackwener/OpenCLI","slug":"source-query-was-not-found-in-the-current-not","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-fulltext.js","lineNumber":37,"sourceCode":"            help: 'Source id or title from the current notebook',\n        },\n    ],\n    columns: ['title', 'kind', 'char_count', '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-fulltext', '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-fulltext', '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-fulltext', `Source \"${query}\" was not found in the current notebook.`);\n        }\n        const fulltext = await getNotebooklmSourceFulltextViaRpc(page, matched.id).catch(() => null);\n        if (fulltext)\n            return [fulltext];\n        throw new EmptyResultError('opencli notebooklm source-fulltext', `NotebookLM fulltext 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-fulltext.js#L19-L45","documentation":"After loading the notebook's source rows, source-fulltext matches the user's --source query with findNotebooklmSourceRow; if no row matches the given title/ID/substring, it throws an EmptyResultError naming the query. This is a lookup miss, not a transport problem — the notebook has sources, just not one matching the query.","triggerScenarios":"Passing a source name that doesn't exist in the notebook, a misspelled title, a stale ID after the source was deleted, a title that changed, or a query whose casing/punctuation differs from the stored title and defeats the matcher.","commonSituations":"Hardcoding source names in scripts after the notebook was edited; using a truncated or paraphrased title; sourcing from a different notebook than assumed; renamed sources.","solutions":["Run the notebook's source list command and copy an exact title or ID from its output.","Check for typos and try a shorter distinctive substring of the title.","Confirm you are querying the notebook you intend (re-open the correct notebook).","If the source was renamed or deleted, re-add it or update the script's configured source name."],"exampleFix":"// before: hardcoded possibly-stale name\nconst text = await sourceFulltext('Q3 Report Final v2');\n// after: resolve the name from the live source list\nconst sources = await listSources();\nconst match = sources.find(s => s.title.includes('Q3'));\nconst text = await sourceFulltext(match.id);","handlingStrategy":"validation","validationCode":"const sources = await runCommand('notebooklm source-list');\nconst exact = sources.find(s => s.title === wanted || s.id === wanted);\nif (!exact) throw new Error(`\"${wanted}\" not in source list; available: ${sources.map(s => s.title).join(', ')}`);","typeGuard":null,"tryCatchPattern":"try {\n  const rows = await runCommand('notebooklm source-fulltext', { source: query });\n} catch (e) {\n  if (e instanceof EmptyResultError && e.message.includes('was not found in the current notebook')) {\n    // list sources, prompt user to pick or correct the query, then retry\n  } else throw e;\n}","preventionTips":["Resolve source names from a live source-list call, never hardcoded strings.","Prefer stable source IDs over titles in scripts.","Use short distinctive substrings rather than exact long titles.","Refresh cached source names whenever the notebook is edited."],"tags":["empty-result","lookup-failed","not-found","notebooklm"],"backgroundTag":"resource-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}