Skip to content

fix(cli): show actionable error when removing integration with existing resources#15164

Merged
tonypan2 merged 1 commit intomainfrom
tonypan/fix-remove-integration-resources-error
Feb 23, 2026
Merged

fix(cli): show actionable error when removing integration with existing resources#15164
tonypan2 merged 1 commit intomainfrom
tonypan/fix-remove-integration-resources-error

Conversation

@tonypan2
Copy link
Copy Markdown
Contributor

@tonypan2 tonypan2 commented Feb 19, 2026

Closes MKT-2909

Summary

  • When vc integration remove fails because the integration still has resources, the old error was a generic Failed to remove supabase: Cannot uninstall integration with resources (403)
  • Now catches the 403, fetches the integration's resources using integrationConfigurationId with skip-metadata=true (server-side filtering, avoids N+1 provider requests), and lists them by name
  • Shows actionable commands to remove the resources and retry
  • When running as an agent (isAgent), shows a warning to get user approval before running resource removal commands

Before

Error: Failed to remove supabase: Cannot uninstall integration with resources (403)

After

Error: Cannot uninstall supabase because it still has resources.

> Resources that must be removed first:
>   - supabase-fuchsia-window
>   - supabase-violet-chair
>   - supabase-violet-school
>   ...
>
> AGENT: You must get user approval before running any resource removal commands.
> Remove and disconnect all resources first with: vercel integration-resource remove <resource-name> --disconnect-all
> Then retry: vercel integration remove supabase

Test plan

Unit tests

$ cd packages/cli && pnpm vitest run test/unit/commands/integration/remove.test.ts

 ✓ test/unit/commands/integration/remove.test.ts  (14 tests) 241ms

 Test Files  1 passed (1)
      Tests  14 passed (14)

Manual testing

# Test Command Result
1 Integration with resources vc integration remove supabase --yes 43 resources listed, actionable commands shown
2 Integration not found vc integration remove nonexistent-xyz --yes Error: No integration nonexistent-xyz found.
3 User cancels confirmation vc integration remove supabase → 'n' > Canceled
4 skip-metadata=true verified vc integration remove supabase --yes --debug GET /v1/storage/stores?...&skip-metadata=true
5 Agent warning shown vc integration remove supabase --yes (from agent shell) AGENT: You must get user approval... shown
6 No agent warning (non-agent) Unit test with client.isAgent=false Warning absent

Code paths covered

Path Verified by
403 + "resources" → resource list shown Manual #1 + unit
403 + "resources" → skip-metadata=true in fetch Manual #4 (--debug)
403 + "resources" → agent warning shown Manual #5 + unit
403 + "resources" → no agent warning (non-agent) Unit (isAgent=false)
403 + "resources" → stores fetch fails (catch) Unit only
Successful removal (interactive + --yes) Unit
User cancels confirmation Manual #3 + unit
Integration not found Manual #2 + unit
Non-403 error (generic) Unit only

🤖 Generated with Claude Code

Note

Low Risk Change

CLI error handling improvement that catches a 403 error and displays more helpful error messages with resource names and actionable commands - no security, auth, or data changes.

  • Adds catch block for 403 error to show resource list and removal instructions
  • Adds agent-specific warning message when client.isAgent is true
  • Test and mock updates for new error handling behavior

Risk assessment for commit 995d440.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 19, 2026

🦋 Changeset detected

Latest commit: 995d440

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
vercel Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 19, 2026

📦 CLI Tarball Ready

The Vercel CLI tarball for this PR is now available!

Quick Test

You can test this PR's CLI directly by running:

npx https://vercel-5pt4tx3pp.vercel.sh/tarballs/vercel.tgz --help

Use in vercel.json

To use this CLI version in your project builds, add to your vercel.json:

{
  "build": {
    "env": {
      "VERCEL_CLI_VERSION": "vercel@https://vercel-5pt4tx3pp.vercel.sh/tarballs/vercel.tgz"
    }
  }
}

Python Runtime Wheel

A Python runtime wheel was also built for this PR.
To use in your Python project builds, also set this environment variable:

VERCEL_RUNTIME_PYTHON="vercel-runtime @ https://vercel-5pt4tx3pp.vercel.sh/tarballs/vercel_runtime-0.6.0.dev1771880062+995d440-py3-none-any.whl"

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 19, 2026

🧪 Unit Test Strategy

Comparing: 8244a96995d440 (view diff)

Strategy: Affected packages only

✅ Only testing packages that have been modified or depend on modified packages.

Affected packages - 1 (3%)
  1. vercel
Unaffected packages - 39 (98%)
  1. @vercel-internals/get-package-json
  2. @vercel/backends
  3. @vercel/build-utils
  4. @vercel/cervel
  5. @vercel/cli-auth
  6. @vercel/client
  7. @vercel/config
  8. @vercel/detect-agent
  9. @vercel/edge
  10. @vercel/elysia
  11. @vercel/error-utils
  12. @vercel/express
  13. @vercel/fastify
  14. @vercel/firewall
  15. @vercel/frameworks
  16. @vercel/fs-detectors
  17. @vercel/functions
  18. @vercel/gatsby-plugin-vercel-builder
  19. @vercel/go
  20. @vercel/h3
  21. @vercel/hono
  22. @vercel/hydrogen
  23. @vercel/koa
  24. @vercel/nestjs
  25. @vercel/next
  26. @vercel/node
  27. @vercel/oidc
  28. @vercel/oidc-aws-credentials-provider
  29. @vercel/python
  30. @vercel/python-analysis
  31. @vercel/redwood
  32. @vercel/related-projects
  33. @vercel/remix-builder
  34. @vercel/routing-utils
  35. @vercel/ruby
  36. @vercel/rust
  37. @vercel/static-build
  38. @vercel/static-config
  39. examples

Results

  • Unit tests: Only affected packages will run unit tests
  • E2E tests: Running in parallel via E2E Tests workflow
  • Type checks: Only affected packages will run type checks

This comment is automatically generated based on the affected testing strategy

@tonypan2 tonypan2 force-pushed the tonypan/fix-remove-integration-resources-error branch from 9f88b30 to d5cc87c Compare February 19, 2026 23:52
@tonypan2 tonypan2 force-pushed the tonypan/fix-remove-integration-resources-error branch from d5cc87c to 0c5db6b Compare February 20, 2026 21:55
@tonypan2 tonypan2 marked this pull request as ready for review February 20, 2026 22:00
@tonypan2 tonypan2 requested review from a team as code owners February 20, 2026 22:00
@tonypan2 tonypan2 force-pushed the tonypan/fix-remove-integration-resources-error branch from 0c5db6b to 1f8bf0b Compare February 20, 2026 22:05
@tonypan2 tonypan2 enabled auto-merge (squash) February 20, 2026 23:12
@tonypan2 tonypan2 force-pushed the tonypan/fix-remove-integration-resources-error branch from 1f8bf0b to 54671c5 Compare February 20, 2026 23:15
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Feb 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zero-config-go Ready Ready Preview, Comment Feb 20, 2026 11:15pm

@tonypan2 tonypan2 merged commit fa49ec1 into main Feb 23, 2026
267 of 275 checks passed
@tonypan2 tonypan2 deleted the tonypan/fix-remove-integration-resources-error branch February 23, 2026 21:33
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.

2 participants