Skip to content

alchemy dev dev-URL detection grabs the first stdout URL, not the dev server's #695

Description

@filipfalcon

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

  1. bun install
  2. bun run dev (runs alchemy dev)
  3. 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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions