microsoft / microsoft/aspire

TS AppHost: addParameter with no default silently blocks startup in non-interactive mode with no actionable error

Open
#17,678 1 comment 0 reactions 0 assignees View on GitHub
area-polyglot triage:bot-seen
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

## Summary

In a TypeScript AppHost, calling \uilder.addParameter('name')\ without a default value causes \spire run\ to hang indefinitely in non-interactive mode (e.g. CI, \--non-interactive\, or any environment where stdin is not a TTY). There is no timeout, no clear error message, and no indication of which parameter is blocking.

## Repro

\\\ ypescript
// apphost.mts
const builder = await createBuilder();

// No default value — will block in non-interactive mode
const greeting = await builder.addParameter('greeting');

const api = await builder.addJavaScriptApp('api', './services/api', { command: 'start' })
.withEnvironment('GREETING', greeting);

await builder.build();
\\\

Run with:
\\\
aspire run --non-interactive
\\\

**Expected:** A clear startup error such as:
\Parameter 'greeting' has no default value and cannot be resolved in non-interactive mode. Set a default via addParameter options or withCustomInput({ value: '...' }).\

**Actual:** \spire run\ hangs with no output and no timeout. The AppHost never reaches steady state.

## Fix

Setting a default value resolves the issue:

\\\ ypescript
const greeting = await builder.addParameter('greeting', { value: 'Hello, World!' })
.withCustomInput({
inputType: InputType.Text,
label: 'Greeting message',
value: 'Hello, World!', // sets the default for non-interactive mode
});
\\\

Note: \ alue\ in either \ddParameter(name, { value })\ or \withCustomInput({ value })\ works as the default for non-interactive mode. This is not currently documented clearly.

## Expected behavior

1. **Fail fast** with a clear message when a parameter has no default and the host is in non-interactive mode — include the parameter name
2. **Warn at build time** if any parameter lacks a default, so developers catch this before deployment/CI
3. **Document the distinction** between \ddParameter\ options \ alue\ vs \withCustomInput({ value })\ — it is not obvious that both can provide defaults

## Context

Discovered during Aspire 13.4 TS polyglot validation. The hang is especially problematic in CI pipelines where \spire run\ is used as part of integration test setup — the process hangs silently rather than failing the pipeline with a useful error.

## Environment

- Aspire version: 13.4
- AppHost type: TypeScript polyglot (\pphost.mts\)

Contributor guide

Open the contributing guide

Research direction

Start with the apphost.mts reproduction and trace createBuilder(), addParameter(), withCustomInput(), and build() when invoked through aspire run --non-interactive. Confirm how parameters without defaults are resolved, then verify completion by exercising the reported non-interactive case and checking that it fails fast with the parameter name, provides a build-time warning, and clarifies both default-value options.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.