From 09f502cc4349ec50e52923cb39c69c14666f5cb3 Mon Sep 17 00:00:00 2001 From: "Tommy D. Rossi" Date: Fri, 23 Jan 2026 17:39:24 +0100 Subject: [PATCH] Update background.ts --- extension/src/background.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extension/src/background.ts b/extension/src/background.ts index f1c6642..4cc5f70 100644 --- a/extension/src/background.ts +++ b/extension/src/background.ts @@ -1122,7 +1122,13 @@ async function handleStartRecording(params: StartRecordingParams): Promise<{ suc const streamId = await new Promise((resolve, reject) => { chrome.tabCapture.getMediaStreamId({ targetTabId: tabId }, (id) => { if (chrome.runtime.lastError) { - reject(new Error(chrome.runtime.lastError.message)) + const errorMsg = chrome.runtime.lastError.message || 'Unknown error' + // Chrome returns this error when activeTab permission hasn't been granted + if (errorMsg.includes('Extension has not been invoked') || errorMsg.includes('activeTab')) { + reject(new Error(`${errorMsg}. Toggle the Playwriter extension icon on this tab to enable recording, then try again.`)) + } else { + reject(new Error(errorMsg)) + } } else if (!id) { reject(new Error('Failed to get media stream ID')) } else {