{"record":{"id":"8d46275d0ce51456","repo":"qeeqbox/social-analyzer","slug":"driver-session-issue","errorCode":null,"errorMessage":"Driver Session Issue","messagePattern":"Driver Session Issue","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"modules/special-scan.js","lineNumber":78,"sourceCode":"      if (source.includes('Try Entering Your Password')) {\n        temp_profile.found += 1\n      }\n      if (temp_profile.found > 0) {\n        temp_profile.text = 'unavailable'\n        temp_profile.title = 'unavailable'\n        temp_profile.rate = '%' + ((temp_profile.found / 1) * 100).toFixed(2)\n        temp_profile.link = site.url.replace('{username}', username)\n        temp_profile.type = site.type\n        resolve(temp_profile)\n      } else {\n        resolve(undefined)\n      }\n    } catch (err) {\n      if (driver !== undefined) {\n        try {\n          await driver.quit()\n        } catch (err) {\n          helper.verbose && console.log('Driver Session Issue')\n        }\n      }\n      resolve(undefined)\n    }\n  })\n}\n\nasync function find_username_site_special_gmail_1 (uuid, username, site) {\n  return new Promise(async (resolve, reject) => {\n    helper.log_to_file_queue(uuid, '[Checking] ' + helper.get_site_from_url(site.url))\n    const driver = new Builder()\n      .forBrowser('firefox')\n      .setFirefoxOptions(new firefox.Options().headless().windowSize({\n        width: 640,\n        height: 480\n      }))\n      .build()\n","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/qeeqbox/social-analyzer/blob/1ba0905e00d054aab833eb3693739c354db09e0f/modules/special-scan.js#L60-L96","documentation":"In find_username_site_special_facebook_1 (modules/special-scan.js:78), 'Driver Session Issue' is a verbose-mode log printed when the Selenium WebDriver cleanup itself fails: after the main scan throws, the catch block calls await driver.quit() and that quit() call rejects. The original scan error is swallowed and only this cleanup failure message is logged, then the promise resolves with undefined.","triggerScenarios":"An exception inside the Facebook selenium scan enters the catch; driver !== undefined; but driver.quit() throws because the session is already dead (browser crashed, driver process exited, session id invalid), and helper.verbose is true so the message is printed.","commonSituations":"Chromedriver/geckodriver version mismatch with installed browser; browser killed by OOM or timeout before quit; session already ended by an earlier quit or browser crash; running in CI/container without a display (headless not configured).","solutions":["Check verbose logs printed before cleanup to find the original scan error that triggered the catch block","Ensure chromedriver version matches the installed Chrome version and the browser is installed/in PATH","Run the driver in headless mode with proper flags when no display is available","Treat a resolved undefined as 'scan failed' and retry the scan, creating a fresh driver instance"],"exampleFix":"// before\nresolve(undefined) // only 'Driver Session Issue' logged, cause lost\n// after\n} catch (err) {\n  helper.verbose && console.log('scan failed:', err)\n  if (driver !== undefined) {\n    try { await driver.quit() } catch (quitErr) {\n      helper.verbose && console.log('Driver Session Issue:', quitErr)\n    }\n  }\n  resolve(undefined)\n}","handlingStrategy":"try-catch","validationCode":"// before scanning, verify the driver is alive\nconst session = await driver.getSession().catch(() => null)\nif (!session) {\n  driver = await new Builder().forBrowser('chrome').build()\n}","typeGuard":"function isDriverAlive(driver) {\n  return driver !== undefined && typeof driver.quit === 'function' && driver.session_ !== undefined\n}","tryCatchPattern":"try {\n  // facebook scan steps\n} catch (scanErr) {\n  console.error('scan failed:', scanErr) // keep the real cause\n  if (driver !== undefined) {\n    try { await driver.quit() } catch (quitErr) {\n      if (!/invalid session|ECONNREFUSED/i.test(String(quitErr))) console.error('Driver Session Issue:', quitErr)\n    }\n  }\n}","preventionTips":["Log the original scan error, not only the cleanup failure, to preserve root cause","Match chromedriver and browser versions before running scans","Use headless + --no-sandbox + --disable-dev-shm-usage in CI containers","Create a fresh driver instance per scan instead of reusing possibly-dead sessions"],"tags":["selenium","webdriver","driver-quit","cleanup"],"backgroundTag":"webdriver-session-already-closed","analyzedSha":"1ba0905e00d054aab833eb3693739c354db09e0f","analyzedAt":"2026-08-31T21:42:26.566Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}