Fosowl/agenticSeek · error · Exception

Could not find: {path}

Error message

Could not find: {path}

What it means

load_js resolves `file_name` inside the library's js_scripts_folder and raises this Exception when the file does not exist (wrapping FileNotFoundError). It means a JavaScript helper that patch_browser_fingerprint, find_all_inputs, or apply_web_safety depends on could not be read from disk, usually because the package's JS assets are missing or were not installed/packaged.

Source

Thrown at sources/browser.py:509

            except ElementClickInterceptedException as e:
                self.logger.error(f"Error click_element: {str(e)}")
                return False
        except TimeoutException:
            self.logger.warning(f"Timeout clicking element.")
            return False
        except Exception as e:
            self.logger.error(f"Unexpected error clicking element at {xpath}: {str(e)}")
            return False
        
    def load_js(self, file_name: str) -> str:
        """Load javascript from script folder to inject to page."""
        path = os.path.join(self.js_scripts_folder, file_name)
        self.logger.info(f"Loading js at {path}")
        try:
            with open(path, 'r') as f:
                return f.read()
        except FileNotFoundError as e:
            raise Exception(f"Could not find: {path}") from e
        except Exception as e:
            raise e

    def find_all_inputs(self, timeout=3):
        """Find all inputs elements on the page."""
        try:
            WebDriverWait(self.driver, timeout).until(
                EC.presence_of_element_located((By.TAG_NAME, "body"))
            )
        except Exception as e:
            self.logger.error(f"Error waiting for input element: {str(e)}")
            return []
        time.sleep(0.5)
        script = self.load_js("find_inputs.js")
        input_elements = self.driver.execute_script(script)
        return input_elements

    def get_form_inputs(self) -> List[str]:

View on GitHub (pinned to ae57a23577)

Solutions

  1. Reinstall the library completely (pip uninstall then pip install, ideally from source/git) so the bundled .js assets are restored.
  2. Check the logged path in 'Loading js at {path}' and verify the file exists at that exact location.
  3. If running from a copy of the repo, run from the project root or restore the js_scripts_folder next to sources/browser.py.
  4. If calling load_js yourself, verify the exact file name against the files present in the js scripts folder (no extension typos).

Example fix

// before
js = browser.load_js("fingerprint.js")  # FileNotFoundError -> Could not find: ...
// after
import os
path = os.path.join(browser.js_scripts_folder, "fingerprint.js")
assert os.path.isfile(path), f"missing asset: {path}"
js = browser.load_js("fingerprint.js")
Defensive patterns

Strategy: validation

Validate before calling

import os

def can_load_js(browser, file_name):
    path = os.path.join(browser.js_scripts_folder, file_name)
    return os.path.isfile(path)

if not can_load_js(browser, "fingerprint.js"):
    raise RuntimeError("library JS assets missing - reinstall the package")

Try / catch

try:
    js = browser.load_js(file_name)
except Exception as e:
    logger.error(f"JS asset missing: {e}")
    js = ""  # or reinstall/repackage fallback

Prevention

When it happens

Trigger: Calling load_js('some_script.js') with a name that has no matching file in the js_scripts_folder; running an install where the package's js assets folder was not shipped (bad pip install, deleted resources, running from a stripped copy of the repo); a typo or renamed JS file passed by callers like patch_browser_fingerprint.

Common situations: Installing the package from a wheel/sdist that omitted the .js resource files; manually deleting or moving the sources/js scripts directory; running the code outside the project root so the relative js_scripts_folder path resolves to a non-existent directory; typos in the file name when calling load_js directly.

Related errors


AI-assisted analysis of Fosowl/agenticSeek@ae57a23577 (2026-08-30). Data as JSON: /api/errors/dbb6ff5bc2dee571. Report an issue: GitHub.