Error: Illegal types Decimal(38, 8) and Float64 of arguments of function divide

Hi there.
I’m getting this error:

ActiveRecord::ActiveRecordError: Response code: 500:
Code: 43, e.displayText() = DB::Exception: Illegal types Decimal(38, 8) and Float64 of arguments of function divide (version 20.8.11.17 (official build))

I have no idea what’s wrong. I can run the query using the IDE but when the query runs as part of a large serial batch I get this error randomly.
The query I’m trying to execute is this:

query ($bip44_bitcoin0_bc_addresses: [String!], $bip44_bitcoin1_bc_addresses: [String!], $bip44_bitcoin0_tx_addresses: [String!], $bip44_bitcoin1_tx_addresses: [String!], $bip44_bitcoin0_tx_hashes: [String!]) {
  bip44_bitcoin0_balances: bitcoin(network: bitcoin) {
    inputs(inputAddress: {in: $bip44_bitcoin0_bc_addresses}) {
      count
      value
      inputAddress {
        address
        annotation
      }
    }
    outputs(outputAddress: {in: $bip44_bitcoin0_bc_addresses}) {
      count
      value
      outputAddress {
        address
        annotation
      }
    }
  }
  bip44_bitcoin1_balances: bitcoin(network: bitcoin) {
    inputs(inputAddress: {in: $bip44_bitcoin1_bc_addresses}) {
      count
      value
      inputAddress {
        address
        annotation
      }
    }
    outputs(outputAddress: {in: $bip44_bitcoin1_bc_addresses}) {
      count
      value
      outputAddress {
        address
        annotation
      }
    }
  }
  bip44_bitcoin0_transactions: bitcoin(network: bitcoin) {
    transactions(
      any: [{inputAddress: {in: $bip44_bitcoin0_tx_addresses}}, {outputAddress: {in: $bip44_bitcoin0_tx_addresses}}]
    ) {
      hash
      inputCount
      inputValue
      outputValue
      txCoinbase
      block {
        height
        timestamp {
          iso8601
        }
      }
      feeValue
      outputCount
    }
  }
  bip44_bitcoin1_transactions: bitcoin(network: bitcoin) {
    transactions(
      any: [{inputAddress: {in: $bip44_bitcoin1_tx_addresses}}, {outputAddress: {in: $bip44_bitcoin1_tx_addresses}}]
    ) {
      hash
      inputCount
      inputValue
      outputValue
      txCoinbase
      block {
        height
        timestamp {
          iso8601
        }
      }
      feeValue
      outputCount
    }
  }
  bip44_bitcoin0_inputs_outputs: bitcoin(network: bitcoin) {
    inputs(txHash: {in: $bip44_bitcoin0_tx_hashes}) {
      transaction {
        hash
      }
      inputAddress {
        address
        annotation
      }
      count
      value
    }
    outputs(txHash: {in: $bip44_bitcoin0_tx_hashes}) {
      transaction {
        hash
      }
      outputAddress {
        address
        annotation
      }
      count
      value
    }
  }
}

Can you share the code snippet where this query is being used? Will help us if there is some context as to what you are trying to do.