Skip to content

Surface TypeScript compiler diagnostics when TypeScript AppHost preflight fails #16918

@maddymontaquila

Description

@maddymontaquila

Description

When a TypeScript AppHost fails during the pre-execution tsc --noEmit -p tsconfig.apphost.json step, aspire start / aspire run only surfaces a generic AppHost failure and exit code 2 to the user. The actual TypeScript compiler diagnostic is captured in the CLI log, but not printed in the terminal output where the user sees the failure.

This makes a normal TypeScript syntax/type error look like an Aspire/AppHost failure instead of showing the actionable compiler error.

Example

CLI output only reports the generic failure and points to the log:

❌ An unexpected error occurred: The TypeScript (Node.js) apphost failed.
📄 See logs at C:\Users\maleger\.aspire\logs\cli_20260510T141023771_detach-child_dba03cd3c6a34b6d98977a88da8b1a9c.log
Exit code: 2

The log contains the useful tsc diagnostic:

[GuestAppHostProject] Launching pre-execution command: npx --no-install tsc --noEmit -p tsconfig.apphost.json
[GuestAppHostProject] Executing: C:\Program Files\nodejs\npx.CMD --no-install tsc --noEmit -p tsconfig.apphost.json
[AppHost] commands.ts(26,57): error TS2339: Property 'get' does not exist on type '() => Promise<ReferenceExpression>'.
[GuestAppHostProject] TypeScript (Node.js) apphost exited with code 2
[AspireCliTelemetry] An unexpected error occurred: The TypeScript (Node.js) apphost failed.

Expected behavior

If the TypeScript AppHost fails because the pre-execution TypeScript compiler check fails, the CLI should surface the tsc output directly in the terminal, e.g. the commands.ts(...): error TS... line, before or alongside the generic AppHost failure.

Actual behavior

The terminal shows only the generic TypeScript AppHost failure / exit code and requires the user to open the detached child log to discover that the root cause is a TypeScript compiler error.

Environment

  • Aspire CLI: 13.3.0+4517e4a1ffb7f00a4c0e66882c2db952d637c0cc
  • Build ID: 13.300.26.25605
  • OS: Windows
  • AppHost type: TypeScript / Node.js
  • Command shape: aspire run --non-interactive --apphost C:\Users\maleger\source\repos\a3\apphost.ts

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions