<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vlad Gerasimchuk</title>
    <description>The latest articles on DEV Community by Vlad Gerasimchuk (@extensionsmarket).</description>
    <link>https://dev.to/extensionsmarket</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4073800%2F8510997a-62ab-4a65-93a5-adbf77b4810f.png</url>
      <title>DEV Community: Vlad Gerasimchuk</title>
      <link>https://dev.to/extensionsmarket</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/extensionsmarket"/>
    <language>en</language>
    <item>
      <title>I let an LLM fill my AI tools directory. 11 months later, 41% of its picks were dead.</title>
      <dc:creator>Vlad Gerasimchuk</dc:creator>
      <pubDate>Mon, 16 Nov 2026 21:03:34 +0000</pubDate>
      <link>https://dev.to/extensionsmarket/i-let-an-llm-fill-my-ai-tools-directory-11-months-later-41-of-its-picks-were-dead-i52</link>
      <guid>https://dev.to/extensionsmarket/i-let-an-llm-fill-my-ai-tools-directory-11-months-later-41-of-its-picks-were-dead-i52</guid>
      <description>&lt;p&gt;In December 2025 my AI tools directory, AI Platforms List, had two jobs that asked DeepSeek for new tools and saved whatever came back into &lt;code&gt;platforms.json&lt;/code&gt;. On December 9 I pushed a commit called "CRITICAL FIX: Stop DeepSeek from hallucinating fake platforms". The main change was this block in the prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;🚨 CRITICAL - DO NOT HALLUCINATE OR MAKE UP PLATFORMS! 🚨
- ONLY suggest platforms you can VERIFY exist
- ONLY include platforms from REAL sources (Product Hunt, GitHub, news articles)
- If you can't find ${platformsPerBatch} REAL platforms, return FEWER
- Fake platforms will be automatically detected and removed
- We prefer QUALITY over QUANTITY - 10 real platforms &amp;gt; 25 fake ones
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each call went to &lt;code&gt;deepseek-chat&lt;/code&gt; over the plain chat completions API. It couldn't search or open a page, so it had no way to verify anything.&lt;/p&gt;

&lt;p&gt;In November 2026 I rebuilt the directory, and we opened every website the old list pointed to. Of the sites that only my two DeepSeek jobs had added, 41% were gone. For the tools the list started with, it was 5.7%.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two jobs, one model
&lt;/h2&gt;

&lt;p&gt;The daily job was a GitHub Action. It ran at 06:00 UTC from December 5, 2025 to January 11, 2026, in three rounds of up to 8 tools. Its prompt asked for tools that "Have a working website/product (no vaporware)" and ranked affiliate programs above everything else: "PRIORITIZE platforms with active affiliate/referral programs (highest priority!)". Every tool it added was saved with &lt;code&gt;added_by: "ai-auto-discovery"&lt;/code&gt; and &lt;code&gt;verified: false&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The mass job went in at 04:00 UTC on December 9, in a commit titled "Add ULTRA HIGH VOLUME discovery modes - 90,000 platforms/month". It ran inside a generator script that looped with 30 seconds between cycles. Every second cycle it called DeepSeek, and after each cycle it pushed its changes to GitHub. Between December 9 and December 18 it added 317 entries.&lt;/p&gt;

&lt;p&gt;Both compared each new name and domain against the list to skip duplicates. Neither one opened the site before saving it.&lt;/p&gt;

&lt;h2&gt;
  
  
  A validator that let parked domains through
&lt;/h2&gt;

&lt;p&gt;About two hours later I added a URL validator, and the generator ran it every tenth cycle. It sent a HEAD request (a GET if the site refused HEAD) with a 10-second timeout. To catch parked domains, it looked for eight strings in the final URL after redirects, such as &lt;code&gt;sedo.com/search&lt;/code&gt; and &lt;code&gt;hugedomains.com&lt;/code&gt;. It never read the page.&lt;/p&gt;

&lt;p&gt;Its first run, at 06:12 UTC on December 9, checked 729 entries and flagged 96 for removal: 81 dead and 15 with DNS errors. Three minutes later I put 34 of them back, because they were real sites that refuse HEAD requests. That run flagged 0 parked domains.&lt;/p&gt;

&lt;p&gt;The prompt fix came about an hour and a half later, and its commit message shows what the validator was up against: "63% of discovered platforms were FAKE (90 out of 143 in Cycle 71)" and "DeepSeek was making up platform names and guessing URLs".&lt;/p&gt;

&lt;h2&gt;
  
  
  The pages built on top
&lt;/h2&gt;

&lt;p&gt;A template turned the list into pages. On January 8, 2026, a commit titled "Generate 1,140 vibe-coding content pages" added 301 comparison files, and every one of them opens with the same line: "Both are powerful vibe coding platforms, each with unique strengths and use cases." Zapier, an automation tool, got that line too. 26 of the files have &lt;code&gt;undefined&lt;/code&gt; in the name, where a slug was missing. &lt;code&gt;zapier-vs-undefined.json&lt;/code&gt; is titled "Zapier vs Claude for VS Code: Which is Better for Vibe Coding in 2026?"&lt;/p&gt;

&lt;p&gt;Three and a half hours later came a second commit, "Add 3,023 comparison pages for all platform combinations". The next day another commit put the whole site at 4,836 pages and 2.75 million words.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Google did in January
&lt;/h2&gt;

&lt;p&gt;Search Console for the domain:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Month&lt;/th&gt;
&lt;th&gt;Impressions&lt;/th&gt;
&lt;th&gt;Clicks&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;December 2025&lt;/td&gt;
&lt;td&gt;994&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;January 2026&lt;/td&gt;
&lt;td&gt;9,840&lt;/td&gt;
&lt;td&gt;57&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;February 2026&lt;/td&gt;
&lt;td&gt;2,357&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;March 2026&lt;/td&gt;
&lt;td&gt;945&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;August 2026&lt;/td&gt;
&lt;td&gt;45&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The best day was January 19, with 1,265 impressions. January 24 had 502, and January 25 had 20. Google's Search Status Dashboard shows no ranking update in that stretch. The December 2025 core update ended on December 29, and the February 2026 Discover update started on February 5. The mass job's last entry was on December 18, and I turned the daily job off on January 11. I don't know which pages Google reacted to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Opening every link, 11 months later
&lt;/h2&gt;

&lt;p&gt;On November 8, 2026, we ran a crawler over all 1,031 websites in the old list (1,095 entries, since some tools shared a site). It made one request per site plus redirects, waited at most 15 seconds, never sent two requests at once to the same host, and identified itself as &lt;code&gt;AIPlatformsListBot&lt;/code&gt; with a link back. Each site that failed got a second try a few minutes later and a third about half an hour after the first. We only counted a shutdown when the site itself said so. For each gone site, we asked the Internet Archive for a capture from 2023 to 2025 and opened it to tell a real page from a parked domain.&lt;/p&gt;

&lt;p&gt;44 sites blocked automated checks. Of the other 987, 763 still work (68 of them under a new name or address) and 176 are gone, which is 17.8%. A parked or for-sale page was the most common way a gone site failed, 51 of the 176.&lt;/p&gt;

&lt;h2&gt;
  
  
  Split by who added each tool
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Added by&lt;/th&gt;
&lt;th&gt;Sites checked&lt;/th&gt;
&lt;th&gt;Gone&lt;/th&gt;
&lt;th&gt;Share gone&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The list I started with (entries marked verified)&lt;/td&gt;
&lt;td&gt;565&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;td&gt;5.7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Research batches, December and January&lt;/td&gt;
&lt;td&gt;76&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;11.8%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Daily DeepSeek job&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;13&lt;/td&gt;
&lt;td&gt;26.0%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mass DeepSeek job, before the Dec 9 fix&lt;/td&gt;
&lt;td&gt;63&lt;/td&gt;
&lt;td&gt;41&lt;/td&gt;
&lt;td&gt;65.1%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mass DeepSeek job, after it&lt;/td&gt;
&lt;td&gt;213&lt;/td&gt;
&lt;td&gt;80&lt;/td&gt;
&lt;td&gt;37.6%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Another 20 checked sites had entries from more than one source, and 1 of those is gone. Counting the two DeepSeek jobs together, including one site both of them added, 134 of 327 checked sites are gone, or 41%.&lt;/p&gt;

&lt;p&gt;After the Dec 9 commit, the mass job's gone share fell from 65.1% to 37.6%. That is still more than six times the rate of the list I started with. For 81 of the mass job's 121 gone sites, the Internet Archive has nothing real from 2023 to 2025: 42 have no capture at all, 37 only a parked page and 2 an empty one. Many of those 81 may never have been products.&lt;/p&gt;

&lt;p&gt;The groups aren't the same age. Most of the original list was in place by June 2025, while the DeepSeek entries came in December, so they had different amounts of time to fail.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading the page, not the URL
&lt;/h2&gt;

&lt;p&gt;A parked domain answers 200, so a status check passes it. The old validator only looked at the URL (trimmed):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// December 2025&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;parkedIndicators&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'domain-for-sale'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'parked-domain'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'this-domain-is-for-sale'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="s1"&gt;'godaddy.com/parking'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'afternic.com'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'sedo.com/search'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'hugedomains.com'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'dan.com'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;isParked&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;parkedIndicators&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;finalUrl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The check the list uses now reads the first 20,000 characters of the page (trimmed):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// November 2026&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;PARKED&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;\&lt;span class="nf"&gt;b&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;is&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;may&lt;/span&gt; &lt;span class="n"&gt;be&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;sale&lt;/span&gt;\&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;buy&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="kc"&gt;this&lt;/span&gt; &lt;span class="n"&gt;domain&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="n"&gt;parked&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;domain&lt;/span&gt; &lt;span class="n"&gt;parking&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;parked&lt;/span&gt; &lt;span class="n"&gt;free&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;hugedomains&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;afternic&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;sedo&lt;/span&gt;\&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;dan&lt;/span&gt;\&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;buy&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="n"&gt;pricing&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;\&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ai&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;\&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;location&lt;/span&gt;\&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;href&lt;/span&gt;\&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;*=&lt;/span&gt;\&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"']\/lander)/i;

if (status &amp;lt; 200 || status &amp;gt;= 300) return { ok: false, reason: `http ${status}` };
if (PARKED.test(html.slice(0, 20_000)) || new URL(finalUrl).pathname.startsWith('/lander')) {
  return { ok: false, reason: 'parked' };
}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some parking pages bounce you to &lt;code&gt;/lander&lt;/code&gt; with a line of JavaScript, which the last test catches. A site that now opens a different domain fails too. And since anyone can submit a URL, including one that points into your own network, the check follows redirects one hop at a time and refuses private addresses at every hop.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changed on the list
&lt;/h2&gt;

&lt;p&gt;When I relaunched the list in November 2026, I dropped the mass job's entries and the research batches. 21 sites that only the daily job had added are still listed, all real products (Krisp and Vectara among them), each opened again on November 10. A tool goes live only after the check above passes, and a person approves every free listing.&lt;/p&gt;

&lt;h2&gt;
  
  
  A mistake I found while writing this
&lt;/h2&gt;

&lt;p&gt;The study I published on November 8 told bot entries apart by a &lt;code&gt;discovered_by&lt;/code&gt; field and an id prefix. The daily job set neither, so its 55 entries were counted with the original list. With them moved, the original list's gone share drops from 7.3% to 5.7% and the bot side's from 36.4% to 35.0%, so the gap grows from five times to six. The study page now shows the corrected numbers.&lt;/p&gt;




&lt;p&gt;The study, with the full CSV (free to reuse under CC BY 4.0): &lt;a href="https://aiplatformslist.com/study/ai-tool-shutdowns-2026" rel="noopener noreferrer"&gt;https://aiplatformslist.com/study/ai-tool-shutdowns-2026&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I wrote this with Claude. It dug through my old repo and ran the checks behind every number before drafting the post. I read and edited it before publishing.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>webdev</category>
      <category>seo</category>
    </item>
    <item>
      <title>React 18 escaped the quotes in my &lt;style&gt; tags, and hydration failed on 22 pages</title>
      <dc:creator>Vlad Gerasimchuk</dc:creator>
      <pubDate>Mon, 16 Nov 2026 07:59:00 +0000</pubDate>
      <link>https://dev.to/extensionsmarket/react-18-escaped-the-quotes-in-my-tags-and-hydration-failed-on-22-pages-4jjm</link>
      <guid>https://dev.to/extensionsmarket/react-18-escaped-the-quotes-in-my-tags-and-hydration-failed-on-22-pages-4jjm</guid>
      <description>&lt;p&gt;Every blog page on my Remix site threw React errors in production, on every load, for months. The pages looked fine, so nobody noticed.&lt;/p&gt;

&lt;p&gt;The cause was one line I had copied into every page:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;css&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How I found it
&lt;/h2&gt;

&lt;p&gt;I build Shopify apps, and most of them have a blog. Before merging a new post, I had Claude Code check it in headless Chrome for console errors, sideways scroll and anything covering anything. The new post was clean. The older posts were not. Every one of them logged the same three minified errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Minified React error #425
Minified React error #418
Minified React error #423
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's "text content does not match server-rendered HTML", "hydration failed", and "the entire root will switch to client rendering". The site runs React 18.2 on Remix 2.16.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the server actually sent
&lt;/h2&gt;

&lt;p&gt;Each page kept its CSS in a template string at the top of the file and rendered it as a child of &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt;. Two of the rules had quotes in them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Inter'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;system-ui&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.nav-links&lt;/span&gt; &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;not&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;.nav-btn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;not&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/blog"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;React escapes text children when it renders on the server. Inside a &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; that's exactly what you want. Inside a &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; it breaks things, because browsers don't decode HTML entities in style text. This is what reached the browser:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nn"&gt;#x27&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="n"&gt;Inter&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nn"&gt;#x27&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;system-ui&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.nav-links&lt;/span&gt; &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;not&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;.nav-btn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;not&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&amp;amp;&lt;/span&gt;&lt;span class="nt"&gt;quot&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nt"&gt;blog&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nt"&gt;quot&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So on first paint the body font rule was broken, and the phone rule that hides extra nav links never matched. Then React hydrated, compared the style text it expected with the escaped text from the server, found a mismatch, and threw away the server HTML to render the whole page again in the browser. After that re-render the CSS was correct, which is why the pages looked normal and the bug hid so well.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;style&lt;/span&gt; &lt;span class="n"&gt;dangerouslySetInnerHTML&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;__html&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;css&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With &lt;code&gt;dangerouslySetInnerHTML&lt;/code&gt;, React writes the string as is, so the quotes survive and the server HTML matches what the client renders. My landing page and my newest post already used this form, which is why those two were clean.&lt;/p&gt;

&lt;p&gt;It's only safe because &lt;code&gt;css&lt;/code&gt; is a fixed string in the source file. I checked all 22, and none of them puts anything into the CSS through &lt;code&gt;${}&lt;/code&gt;. Never pass user input through this.&lt;/p&gt;

&lt;p&gt;After the change, all 22 pages had zero escaped quotes in their CSS and zero errors in the console, on desktop and phone widths.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check your own site
&lt;/h2&gt;

&lt;p&gt;The browser won't show you the problem, because by the time you open DevTools, React has already re-rendered the page and the style text in the DOM looks correct. Look at the raw HTML instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s https://your-site.com/some-page &lt;span class="o"&gt;|&lt;/span&gt; grep -o &lt;span class="s2"&gt;"&amp;lt;style&amp;gt;[^&amp;lt;]*&amp;amp;#x27;"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; head -3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Any output means a style block left the server with escaped quotes. Search for &lt;code&gt;&amp;amp;quot;&lt;/code&gt; too. The other sign is minified React errors #418, #423 or #425 in your production console.&lt;/p&gt;

&lt;p&gt;The bug was on the blog of &lt;a href="https://ezstock.app/blog" rel="noopener noreferrer"&gt;EZstock&lt;/a&gt;, my inventory app for Shopify. View the source there to see the fixed version.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I wrote this with help from Claude, which also ran the browser checks that found the bug.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>remix</category>
      <category>webdev</category>
      <category>css</category>
    </item>
    <item>
      <title>A stuck Postgres lock took my whole site down. Here's the one-line cause and the fix.</title>
      <dc:creator>Vlad Gerasimchuk</dc:creator>
      <pubDate>Tue, 11 Aug 2026 23:03:22 +0000</pubDate>
      <link>https://dev.to/extensionsmarket/a-stuck-postgres-lock-took-my-whole-site-down-heres-the-one-line-cause-and-the-fix-59am</link>
      <guid>https://dev.to/extensionsmarket/a-stuck-postgres-lock-took-my-whole-site-down-heres-the-one-line-cause-and-the-fix-59am</guid>
      <description>&lt;p&gt;My site started returning HTTP 500 on every request today. Not a slow page, not one broken route. The entire app was down. Here's what it turned out to be and how I stopped it from happening again, in case it saves someone a bad afternoon.&lt;/p&gt;

&lt;h2&gt;
  
  
  The symptom
&lt;/h2&gt;

&lt;p&gt;Every request returned a bare &lt;code&gt;Internal Server Error&lt;/code&gt;. The app container was technically "online" in my host's dashboard, but nothing rendered. Checking the response headers confirmed the 500 was coming from my app, not the CDN or a DNS problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading the logs
&lt;/h2&gt;

&lt;p&gt;The logs were a wall of the same error repeating every few minutes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;error: An error occurred while loading instrumentation hook: canceling statement due to lock timeout
code: '55P03'
where: 'while inserting index tuple in relation "queue"'
  at pgboss.create_queue(text,jsonb)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things jumped out. First, Postgres error &lt;code&gt;55P03&lt;/code&gt; is &lt;code&gt;lock_not_available&lt;/code&gt;, meaning a statement gave up waiting for a lock. Second, it was firing inside &lt;code&gt;pgboss.create_queue&lt;/code&gt;, which runs when my background worker boots.&lt;/p&gt;

&lt;p&gt;The database had also logged that it "was not properly shut down" earlier, so a previous session had left a lock on the &lt;code&gt;pgboss.queue&lt;/code&gt; table. My worker's boot tried to create its queue, couldn't get the lock, timed out, and threw.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why one stuck lock nuked the entire site
&lt;/h2&gt;

&lt;p&gt;This is the part worth internalizing. My worker boots inside the web process through Next.js's instrumentation hook:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;register&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;NEXT_RUNTIME&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nodejs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;startWorker&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./worker/start&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;startWorker&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// &amp;lt;-- this await is the problem&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because &lt;code&gt;register()&lt;/code&gt; awaited the worker boot, and the worker threw on the lock, the error propagated straight out of the instrumentation hook. Next.js treats a failed instrumentation hook as a fatal boot error and aborts the whole server. So a background-queue problem became a total front-end outage. The worker and the web server had no business sharing a failure domain, but that one &lt;code&gt;await&lt;/code&gt; tied them together.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix, in two parts
&lt;/h2&gt;

&lt;p&gt;First, recover: restart Postgres to clear the stuck lock, then redeploy the app so it boots cleanly against the healthy database. The app-alone redeploy is not enough on its own, because the lock is still held until Postgres restarts.&lt;/p&gt;

&lt;p&gt;Second, and more important, make it impossible for this to take the site down again. The web server should boot even if the worker can't:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;register&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;NEXT_RUNTIME&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nodejs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;startWorker&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./worker/start&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="c1"&gt;// Fire-and-forget. A worker failure must never abort the web server.&lt;/span&gt;
    &lt;span class="nf"&gt;startWorker&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;worker boot failed (site stays up, will retry):&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I made the worker itself resilient so it self-heals once the lock clears, instead of dying on the first failure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;started&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;starting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;RETRY_DELAYS_MS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;15000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;30000&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;startWorker&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;started&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;starting&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// only skip once it's ACTUALLY running&lt;/span&gt;
  &lt;span class="nx"&gt;starting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;boss&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;PgBoss&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;connectionString&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DATABASE_URL&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;boss&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;start&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;boss&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;work&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;myqueue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;started&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;starting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;delay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;RETRY_DELAYS_MS&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;RETRY_DELAYS_MS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)];&lt;/span&gt;
      &lt;span class="nx"&gt;attempt&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`worker boot failed (attempt &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;), retrying in &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;ms`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;boss&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stop&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;graceful&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
      &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The old code had a subtle second bug: it set &lt;code&gt;started = true&lt;/code&gt; before &lt;code&gt;boss.start()&lt;/code&gt; could throw. So after any failed boot, every retry hit &lt;code&gt;if (started) return&lt;/code&gt; and the worker stayed dead forever. Flipping &lt;code&gt;started&lt;/code&gt; only on success fixes that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A background job's boot should never share a failure domain with your web server. If you boot a worker inside a web process, catch its failure and let the web server come up regardless.&lt;/li&gt;
&lt;li&gt;Only mark something "started" after it has actually started. Setting the flag optimistically means a crash locks you out of ever retrying.&lt;/li&gt;
&lt;li&gt;Postgres &lt;code&gt;55P03&lt;/code&gt; in a queue library almost always means a leftover lock from an unclean shutdown. Restarting the database clears it; restarting only the app usually does not.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A transient database hiccup now degrades to "jobs lag for a minute while the worker retries" instead of "the whole site is down." That's the trade I wanted.&lt;/p&gt;

&lt;p&gt;Anyone else run their background worker in-process with their web server? Curious how you isolate the two.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>postgres</category>
      <category>nextjs</category>
      <category>debugging</category>
    </item>
  </channel>
</rss>
