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_transfer in Api::V1::TransfersController (app/controllers/api/v1/transfers_controller.rb:32). The valid_uuid? guard rejects malformed ids with ActiveRecord::RecordNotFound; otherwise transfers_scope (transfer_decision_scope(Transfer), family-scoped with the shared decision filtering) must find the row. Result is 404 record_not_found.

Source

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

    @pagy, @transfers = pagy(
      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_transfer
      raise ActiveRecord::RecordNotFound unless valid_uuid?(params[:id])

      @transfer = transfers_scope.find(params[:id])
    end

    def transfers_scope
      transfer_decision_scope(Transfer)
    end
end

View on GitHub (pinned to e69894adb9)

Solutions

  1. List with GET /api/v1/transfers and use an id from that collection
  2. Do not reuse ids across /transfers and /rejected_transfers
  3. Validate UUID format before the call
  4. Treat 404 as resolved/gone and re-list
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, 'transfer id must be a UUID'

Try / catch

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

Prevention

When it happens

Trigger: GET /api/v1/transfers/:id with a non-UUID; a transfer id belonging to another family; an id taken from the rejected_transfers collection (a RejectedTransfer, not a Transfer).

Common situations: Cross-collection id confusion between /transfers and /rejected_transfers; multi-family API key mix-ups; transfers consolidated or removed after review.

Related errors


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