Skip to content

Retrying integration setup after a validation error causes 500 #124126

Description

@sentry-junior

Summary

Retrying an API-driven integration setup pipeline (e.g. Claude Agent) after a validation failure returns a generic 500 Internal Error instead of a clean validation message, because the pipeline's step index has already advanced past the retryable step.

Steps to reproduce

  1. POST /api/0/organizations/{org}/pipeline/integration_pipeline/ with an invalid API key for the Claude Agent (claude_code) integration → correctly returns 400 with "Invalid Anthropic API key. Please check your credentials." or via web UI navigate to Settings -> Integrations -> Claude Agent -> Add Agent, intentionally enter invalid API key
Image Image
  1. Retry the same request (same pipeline session, different key) → returns 500 with {"detail": "Internal Error", "errorId": "..."} instead of a validation error. Or in web UI click "Continue" one more time (not "Start over")
Image Image

Diagnosis

  • api_advance() increments step_index before api_finish_pipeline() runs.
  • api_finish_pipeline() returns a PipelineStepResult.error(...) on a validation failure but does not roll back step_index.
  • On retry within the same session, the pipeline resolves api_steps[step_index], which is now out of range for providers with a single API step (e.g. Claude Agent's get_pipeline_api_steps() returns only [ClaudeCodeApiKeyApiStep()]), producing an unhandled exception and generic 500.

Reproduced against org sentry-sn0 with errorId a833faf7eb9f4c81821613e43e14c676.

Impact

Low severity — reloading the integration setup page before retrying avoids the bug — but the resulting 500/Internal Error is confusing for customers troubleshooting a bad API key.

via Igor M.

--

View Junior Session [Sentry]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions