we-promise/sure · error · ActiveRecord::RecordNotFound

record_not_found

record_not_found

Error message

The requested resource was not found

What it means

Raised by set_rejected_transfer in Api::V1::RejectedTransfersController (app/controllers/api/v1/rejected_transfers_controller.rb:32). The valid_uuid? guard rejects malformed ids up front; otherwise rejected_transfers_scope (transfer_decision_scope(RejectedTransfer)) must contain the row, which filters rejected transfers by the token owner's family and the transfer-decision filters. Missing either way, ActiveRecord::RecordNotFound becomes a 404 record_not_found.

Source

Thrown at app/controllers/api/v1/rejected_transfers_controller.rb:32

    @pagy, @rejected_transfers = pagy(
      rejected_transfers_query,
      page: safe_page_param,
      limit: @per_page
    )

    render :index
  rescue Api::V1::TransferDecisionFiltering::InvalidFilterError => e
    render_validation_error(e.message)
  end

  def show
    render :show
  end

  private

    def set_rejected_transfer
      raise ActiveRecord::RecordNotFound unless valid_uuid?(params[:id])

      @rejected_transfer = rejected_transfers_scope.find(params[:id])
    end

    def rejected_transfers_scope
      transfer_decision_scope(RejectedTransfer)
    end
end

View on GitHub (pinned to e69894adb9)

Solutions

  1. List candidates with GET /api/v1/rejected_transfers and use an id from that collection only
  2. Do not mix ids between /transfers and /rejected_transfers
  3. Validate the id is a UUID before requesting
  4. Handle 404 as 'already handled/gone' rather than retrying
Defensive patterns

Strategy: try-catch

Validate before calling

UUID_RE = /\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z/i
UUID_RE.match?(id) or raise ArgumentError, 'id must be a UUID'

Try / catch

begin
  client.get("/api/v1/rejected_transfers/#{id}")
rescue Faraday::ResourceNotFound
  # 404: not a rejected transfer in this family's decision scope
end

Prevention

When it happens

Trigger: GET /api/v1/rejected_transfers/:id with a non-UUID id; a rejected transfer belonging to another family; a transfer id that exists but is not a RejectedTransfer (e.g. an accepted Transfer id).

Common situations: Client reuses an id from the /transfers collection against /rejected_transfers; multi-family API key confusion; record permanently resolved/removed.

Related errors


AI-assisted analysis of we-promise/sure@e69894adb9 (2026-08-21). Data as JSON: /api/errors/7c6d321ba8372558. Report an issue: GitHub.