pear-devs/pear-desktop · error · Error

bad HTTPStatus(${response.statusText})

Error message

bad HTTPStatus(${response.statusText})

What it means

The Megalobiz lyrics provider performs a search request with a 5-second timeout; any non-OK HTTP status throws 'bad HTTPStatus(<statusText>)'. Note AbortSignal.timeout means requests exceeding 5s reject with a TimeoutError (a different error) — this one specifically covers HTTP-level failures.

Source

Thrown at src/plugins/synced-lyrics/providers/Megalobiz.ts:32

    .replace(/\s+by$/, '');
};

export class Megalobiz implements LyricProvider {
  public name = 'Megalobiz';
  public baseUrl = 'https://www.megalobiz.com';
  private domParser = new DOMParser();

  // prettier-ignore
  async search({ title, artist, songDuration }: SearchSongInfo): Promise<LyricResult | null> {
    const query = new URLSearchParams({
      qry: `${artist} ${title}`,
    });

    const response = await fetch(`${this.baseUrl}/search/all?${query}`, {
      signal: AbortSignal.timeout(5_000),
    });
    if (!response.ok) {
      throw new Error(`bad HTTPStatus(${response.statusText})`);
    }

    const data = await response.text();
    const searchDoc = this.domParser.parseFromString(data, 'text/html');

    // prettier-ignore
    const searchResults: MegalobizSearchResult[] = Array.prototype.map
      .call(searchDoc.querySelectorAll('a.entity_name[href^="/lrc/maker/"][name][title]'),
        (anchor: HTMLAnchorElement) => {
          const { minutes, seconds, millis } = anchor
            .getAttribute('title')!
            .match(/\[(?<minutes>\d+):(?<seconds>\d+)\.(?<millis>\d+)\]/)!
            .groups!;

          let name = anchor.getAttribute('name')!;

          const artists = [
            removeNoise(name.match(/\(?[Ff]eat\. (.+)\)?/)?.[1] ?? ''),

View on GitHub (pinned to 1e2aac5706)

Solutions

  1. Fall back to LRCLib or Genius when Megalobiz fails (it's a secondary provider)
  2. Retry once — transient failures are common on this host
  3. If it persists, temporarily disable the Megalobiz provider in plugin config
  4. Verify the site is reachable in a browser

Example fix

// before
const r = await megalobiz.search(info);

// after
try { return await megalobiz.search(info); }
catch (e) { if (!/bad HTTPStatus/.test(e.message)) throw e; return await lrclib.search(info); }
Defensive patterns

Strategy: fallback

Try / catch

try { return await megalobiz.search(info); } catch (e) {
  if (/bad HTTPStatus/.test(e.message)) return await lrclib.search(info);
  throw e;
}

Prevention

When it happens

Trigger: megalobiz.com being slow/down or returning 5xx; 4xx statuses; rate limiting; proxy/firewall interference. Timeout >5s surfaces as a TimeoutError instead, but flaky slow servers often produce both.

Common situations: Megalobiz (a smaller lyrics site) having poor uptime; network restrictions; batch lyric lookups; mobile/high-latency networks where the site struggles.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of pear-devs/pear-desktop@1e2aac5706 (2026-08-27). Data as JSON: /api/errors/2a814c4d2a569ab4. Report an issue: GitHub.