Show error message in Aspire panel when CLI does not support describe#15181
Conversation
When 'aspire describe --follow' exits without producing valid data, show the errorWelcome view informing the user that the CLI version doesn't support this feature and needs updating. - Track whether describe ever received valid NDJSON data - If process exits without data, set error state to show errorWelcome - If process exits after receiving data, retry with backoff as before - Clear error state on refresh so the error page dismisses immediately
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15181Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15181" |
There was a problem hiding this comment.
Pull request overview
This PR updates the Aspire VS Code extension’s workspace resource watcher (aspire describe --follow) to surface a user-facing error state in the Aspire panel when the command exits without producing valid NDJSON (e.g., older CLI that doesn’t support describe), instead of silently retrying forever.
Changes:
- Track whether
aspire describe --followever produced valid resource data and use that to decide between showing an error vs. restarting with backoff. - Clear the panel error state immediately on
refresh()so the error welcome view dismisses before re-attempting. - Update the Aspire panel error welcome text to mention restarting VS Code after updating the CLI.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| extension/src/views/AppHostDataRepository.ts | Adds _describeReceivedData and changes describe-exit handling to show an error welcome when no valid NDJSON is ever observed. |
| extension/package.nls.json | Updates the error welcome string to include “restart VS Code” guidance. |
You can also share your feedback on Copilot code review. Take the survey.
| if (!this._describeReceivedData) { | ||
| // The process exited without ever producing valid data. | ||
| // This likely means the CLI does not support the describe command. | ||
| extensionLogOutputChannel.warn('aspire describe --follow exited without producing data; the installed Aspire CLI may not support this feature.'); | ||
| this._setError(errorFetchingAppHosts(`exit code ${code}`)); | ||
| this._updateWorkspaceContext(); | ||
| } else { |
There was a problem hiding this comment.
In aspire describe --follow, the CLI intentionally returns exit code 0 when no AppHost is running (it prints an informational message and exits). With the new logic, that case will still have _describeReceivedData === false, so the extension will set aspire.fetchAppHostsError and show the error welcome even though this is a normal “no running apphosts” scenario. Consider only treating "no data" as an error when the process exits non-zero (and keep the previous backoff/retry + clear-error behavior for code 0). Also, when setting the error state, clear _workspaceResources so the viewsWelcome error page is guaranteed to display (it won’t show if the tree has existing items).
| "views.runningAppHosts.name": "Running AppHosts", | ||
| "views.runningAppHosts.welcome": "No running Aspire apphost detected in this workspace.\n[Refresh](command:aspire-vscode.refreshRunningAppHosts)", | ||
| "views.runningAppHosts.errorWelcome": "The Aspire CLI is not installed or does not support this feature. Install or update the Aspire CLI to get started.\n[Update Aspire CLI](command:aspire-vscode.updateSelf)\n[Refresh](command:aspire-vscode.refreshRunningAppHosts)", | ||
| "views.runningAppHosts.errorWelcome": "The Aspire CLI is not installed or does not support this feature. Install or update the Aspire CLI and restart VS Code to get started.\n[Update Aspire CLI](command:aspire-vscode.updateSelf)\n[Refresh](command:aspire-vscode.refreshRunningAppHosts)", |
There was a problem hiding this comment.
This string was updated in package.nls.json, but the checked-in localization source XLF (extension/loc/xlf/aspire-vscode.xlf) is generated from package.nls.json (see gulpfile.js export task) and will be out of sync until it’s regenerated. Please re-run the l10n export/generation step and include the updated XLF so localization tooling and translators pick up the new source text.
…ate XLF - Only treat 'no data received' as an error when exit code is non-zero; exit code 0 with no data means no AppHost is running (normal scenario). - Clear _workspaceResources when setting error so the errorWelcome page is guaranteed to display. - Regenerate aspire-vscode.xlf to reflect updated package.nls.json.
Description
When
aspire describe --followexits without producing valid NDJSON data (e.g., because the installed Aspire CLI is too old and doesn't support thedescribecommand), the extension now shows the existingerrorWelcomeview in the Aspire panel. This informs the user that their CLI version doesn't support this feature and provides buttons to update the CLI or refresh.Previously, the exit callback would silently retry with exponential backoff forever, never surfacing the error to the user.
Changes
AppHostDataRepository.ts: Added a_describeReceivedDataflag that tracks whether the describe process ever produced valid data. On exit:errorWelcomeview)refresh()→ clear error state immediately so the error page dismisses before re-attemptingpackage.nls.json: Updated error message to mention restarting VS Code after updating the CLI.Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: