If you run into this error for adapter-static / SSG, you can detect the build process via building and avoid accessing page.url.searchParams while building:
<script>
import { building } from '$app/environment';
let results = $derived.by(() => {
const searchText = !building ? page.url.searchParams.get('searchText') || "" : "";
Thanks very much to Scott (Svelte Discord)