FujiwaraChoki/MoneyPrinterV2 · error · FileNotFoundError

Expected built scraper binary at: {built_binary}

Error message

Expected built scraper binary at: {built_binary}

What it means

Raised by Outreach.build_scraper after `go build` succeeds but the expected binary is not at scraper_dir/<binary_name>. This means the Go toolchain produced output under a different name/location than expected (Go names binaries after the module/directory, not necessarily the expected name).

Source

Thrown at src/classes/Outreach.py:112

            if platform.system() == "Windows"
            else "google-maps-scraper"
        )
        if os.path.exists(binary_name):
            print(colored("=> Scraper already built. Skipping build.", "blue"))
            return

        scraper_dir = self._find_scraper_dir()
        if not scraper_dir:
            raise FileNotFoundError(
                "Could not locate extracted google-maps-scraper directory."
            )

        subprocess.run(["go", "mod", "download"], cwd=scraper_dir, check=True)
        subprocess.run(["go", "build"], cwd=scraper_dir, check=True)

        built_binary = os.path.join(scraper_dir, binary_name)
        if not os.path.exists(built_binary):
            raise FileNotFoundError(f"Expected built scraper binary at: {built_binary}")

        os.replace(built_binary, binary_name)

    def run_scraper_with_args_for_30_seconds(self, args: str, timeout=300) -> None:
        """
        Run the scraper with the specified arguments for 30 seconds.

        Args:
            args (str): The arguments to run the scraper with.
            timeout (int): The time to run the scraper for.

        Returns:
            None
        """
        info(" => Running scraper...")
        binary_name = (
            "google-maps-scraper.exe"
            if platform.system() == "Windows"

View on GitHub (pinned to 5192af8eca)

Solutions

  1. Pin the scraper release version whose module name matches binary_name
  2. Build with an explicit output flag: subprocess.run(['go','build','-o', binary_name], cwd=scraper_dir, check=True) so the binary lands where expected
  3. Verify the extracted scraper's go.mod module name matches the expected binary name

Example fix

// before
subprocess.run(["go", "build"], cwd=scraper_dir, check=True)
built_binary = os.path.join(scraper_dir, binary_name)

// after
subprocess.run(["go", "build", "-o", binary_name], cwd=scraper_dir, check=True)
built_binary = os.path.join(scraper_dir, binary_name)
Defensive patterns

Strategy: fallback

Try / catch

try:
    outreach.build_scraper()
except FileNotFoundError as exc:
    # binary landed under the Go module's own name — build with explicit -o
    subprocess.run(["go", "build", "-o", binary_name], cwd=scraper_dir, check=True)

Prevention

When it happens

Trigger: The Go module's directory name differs from binary_name, so `go build -`-style default output lands elsewhere; go.mod module renames in a newer scraper release; or a stale/empty build directory.

Common situations: Upgrading google-maps-scraper to a version whose module name changed; building on a machine where GOBIN/GOFLAGS redirect output; running build with cached failure without check=True catching it.

Related errors


AI-assisted analysis of FujiwaraChoki/MoneyPrinterV2@5192af8eca (2026-08-28). Data as JSON: /api/errors/add5debd43111ddc. Report an issue: GitHub.