Skip to content

feat(compute): improve error message when instance not found in zone#805

Merged
natalie-o-perret merged 1 commit intomasterfrom
natalieperret/sc-167368/exo-cli-minor-ux-improvement-exo-compute
Apr 2, 2026
Merged

feat(compute): improve error message when instance not found in zone#805
natalie-o-perret merged 1 commit intomasterfrom
natalieperret/sc-167368/exo-cli-minor-ux-improvement-exo-compute

Conversation

@natalie-o-perret
Copy link
Copy Markdown
Contributor

@natalie-o-perret natalie-o-perret commented Feb 26, 2026

Description

When exo compute instance <action> commands fail because the instance does not exist in the default zone, the error message previously surfaced a raw SDK message with no context:

"foo" not found in ListInstancesResponse: Not Found

This PR introduces a findInstance helper in cmd/compute/instance/instance.go that wraps FindListInstancesResponseInstances and enriches the not-found error with the zone that was searched and a hint to use -z:

instance "foo" not found in zone ch-gva-2
Hint: use -z <zone> to specify a different zone, or run 'exo compute instance list' to see instances across all zones

Changes:

  • Added findInstance helper in cmd/compute/instance/instance.go, wrapping FindListInstancesResponseInstances with zone-aware error enrichment.
  • Migrated all 24 call sites across the instance subcommands (show, reboot, start, stop, scale, update, reset, reset-password, reveal-password, resize-disk, scp, ssh, snapshot create, snapshot revert, security-group add/remove, private-network attach/detach/update-ip, elastic-ip attach/detach, enable-tpm, console-url, delete) to use the new helper.
  • Added tests/e2e/scenarios/with-api/compute/instance_not_found_error.txtar, an API-driven e2e scenario verifying the enriched error message on show, reboot and stop. Uses the testscript runner from tests/e2e: add API testscript runner and compute instance reboot scenario #804.
  • Redirected go test stderr to stdout in .github/workflows/e2e.yml to suppress a spurious "Error" banner in the GitHub Actions UI that appeared when the test runner wrote to stderr, even though the job itself succeeded.

Checklist

(For exoscale contributors)

  • Changelog updated (under Unreleased block, and add the Pull Request #number for each bit you add to the CHANGELOG.md)
  • Testing

Testing

Covered by the e2e scenario above (requires API credentials, runs under -tags=api).

@natalie-o-perret natalie-o-perret force-pushed the natalieperret/sc-167368/exo-cli-minor-ux-improvement-exo-compute branch 2 times, most recently from 1353595 to 242469c Compare February 26, 2026 22:58
@natalie-o-perret natalie-o-perret changed the base branch from master to natalieperret/sc-167544/feature-request-cli-add-testscript February 26, 2026 22:58
@natalie-o-perret natalie-o-perret force-pushed the natalieperret/sc-167544/feature-request-cli-add-testscript branch from 40b598f to 9ca3d94 Compare February 27, 2026 08:47
@natalie-o-perret natalie-o-perret force-pushed the natalieperret/sc-167368/exo-cli-minor-ux-improvement-exo-compute branch from 242469c to dd783eb Compare February 27, 2026 08:48
Base automatically changed from natalieperret/sc-167544/feature-request-cli-add-testscript to master March 4, 2026 07:32
@natalie-o-perret natalie-o-perret force-pushed the natalieperret/sc-167368/exo-cli-minor-ux-improvement-exo-compute branch 3 times, most recently from 026fc0d to 3961716 Compare March 4, 2026 09:29
@natalie-o-perret natalie-o-perret marked this pull request as ready for review March 4, 2026 10:29
@natalie-o-perret natalie-o-perret requested review from a team and nerzhul March 4, 2026 10:29
Copy link
Copy Markdown
Member

@imiric imiric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! The error message is certainly an improvement, and the testscript scenarios are a nice touch 👍

If @kobajagi's suggestion is addressed, this is ready for merging, no?

@natalie-o-perret natalie-o-perret force-pushed the natalieperret/sc-167368/exo-cli-minor-ux-improvement-exo-compute branch from 3961716 to 5d62c4d Compare April 2, 2026 11:49
…[sc-167368]

- Introduce findInstance helper wrapping FindListInstancesResponseInstances
  with a zone-aware error and -z hint when the instance is not found.
- Apply findInstance across all 24 instance subcommands that look up by name/ID.
- Add e2e txtar tests covering every affected command.
- Redirect go test stderr in e2e CI to suppress false Error banner in Actions UI.
@natalie-o-perret natalie-o-perret force-pushed the natalieperret/sc-167368/exo-cli-minor-ux-improvement-exo-compute branch from 5d62c4d to 203b3f1 Compare April 2, 2026 11:52
@natalie-o-perret natalie-o-perret merged commit efdc64c into master Apr 2, 2026
6 checks passed
@natalie-o-perret natalie-o-perret deleted the natalieperret/sc-167368/exo-cli-minor-ux-improvement-exo-compute branch April 2, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants