alchemy dev detects a dev server's URL by scanning the dev command's output
for the first http(s):// URL. If the command prints any unrelated URL
first — an error link, a docs link, an "update available" notice — Alchemy
reports that as the resource's url instead of the actual http://localhost.
Steps to reproduce
bun install
bun run dev (runs alchemy dev)
- Read the stack output object.
The dev-server.mjs prints a stray docs link before starting and printing its
real URL — mimicking what Astro does on a content error (see below).
MRE: https://github.com/filipfalcon/mre-alchemy-devserver-reports-unrelated-stdout-url-as-dev-url
Expected behavior
site.url is the dev server's own URL:
{ site: "http://localhost:5001/" }
Actual behavior
site.url is the first unrelated URL printed on stdout:
{ site: "https://docs.astro.build/en/guides/content-collections/" }
Root cause
Alchemy's dev URL detection (src/Command/Dev.ts) resolves on the first
regex match across stdout/stderr:
const URL_REGEX = /https?:\/\/[^\s)\],"'`]+/;
// … extractUrl(buffer) → resolves the url deferred on the first match
It has no notion of "the dev server's own URL" — any http(s):// line wins,
including diagnostics. Real dev servers routinely print URLs before/around
their own (error links, docs links, update notices), so this misfires in
practice.
Real-world trigger
The original sighting: a Starlight splash page missing the required title
frontmatter makes Astro throw an InvalidContentEntryDataError and print a
https://docs.astro.build/en/guides/content-collections/ link. alchemy dev
then surfaces that docs link as the dev server URL. This MRE reproduces the
same outcome with a one-line stray URL, with no Starlight/Astro dependency.
Environment
- alchemy: 2.0.0-beta.58
- effect: 4.0.0-beta.90
- @effect/platform-bun / @effect/platform-node: 4.0.0-beta.90
- Bun: 1.3.13
- OS: macOS (Darwin 25.5.0)
alchemy devdetects a dev server's URL by scanning the dev command's outputfor the first
http(s)://URL. If the command prints any unrelated URLfirst — an error link, a docs link, an "update available" notice — Alchemy
reports that as the resource's
urlinstead of the actualhttp://localhost.Steps to reproduce
bun installbun run dev(runsalchemy dev)The
dev-server.mjsprints a stray docs link before starting and printing itsreal URL — mimicking what Astro does on a content error (see below).
MRE: https://github.com/filipfalcon/mre-alchemy-devserver-reports-unrelated-stdout-url-as-dev-url
Expected behavior
site.urlis the dev server's own URL:Actual behavior
site.urlis the first unrelated URL printed on stdout:Root cause
Alchemy's dev URL detection (
src/Command/Dev.ts) resolves on the firstregex match across stdout/stderr:
It has no notion of "the dev server's own URL" — any
http(s)://line wins,including diagnostics. Real dev servers routinely print URLs before/around
their own (error links, docs links, update notices), so this misfires in
practice.
Real-world trigger
The original sighting: a Starlight splash page missing the required
titlefrontmatter makes Astro throw an
InvalidContentEntryDataErrorand print ahttps://docs.astro.build/en/guides/content-collections/link.alchemy devthen surfaces that docs link as the dev server URL. This MRE reproduces the
same outcome with a one-line stray URL, with no Starlight/Astro dependency.
Environment