Heap error reading aht10 over ic2 expansion board

Hello,
I am looking for help to interpret an error message. My scenario is thus:
I can read a single AHT10 sensor directly without any unusual behaviour.
However, with the same single AHT10 connected through a TCA9548A expansion board, it will loop twice, and then spit out the following error message on the console:
// console output
Free internal heap: 330568 //first loop
Chan 0 Temperature: 18.68 degrees C
Chan 0 Humidity: 18.35% rH
Free internal heap: 330624 //second loop
Chan 0 Temperature: 18.67 degrees C
Chan 0 Humidity: 18.32% rH
CORRUPT HEAP: Bad head at 0x3ffb9570. Expected 0xabba1234 got 0x3ffb8014

assert failed: multi_heap_free multi_heap_poisoning.c:279 (head != NULL)

...
...
Rebooting...
// end console output

I adapted this fellow's code for reading 4 BME280s through the multiplexer:

/*********
  Rui Santos -
  Complete project details at https://RandomNerdTutorials.com/tca9548a-i2c-multiplexer-esp32-esp8266-arduino/
  
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files.
  
  The above copyright notice and this permission notice shall be included in all
  copies or substantial portions of the Software.
*********/

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_AHT10.h>

Adafruit_AHT10 aht1;


// Select I2C BUS
void TCA9548A(uint8_t bus){
  Wire.beginTransmission(0x70);  // TCA9548A address
  Wire.write(1 << bus);          // send byte to select bus
  Wire.endTransmission();
}

void printValues(Adafruit_AHT10 aht, int bus) {
 
  TCA9548A (bus);
 
  sensors_event_t humidity, temp;

  aht.getEvent(&humidity, &temp);// populate temp and humidity objects with fresh data

  Serial.print("Chan ");
  Serial.print(bus);
  Serial.print(" Temperature: "); Serial.print(temp.temperature); Serial.println(" degrees C");

  Serial.print("Chan ");
  Serial.print(bus);
  Serial.print(" Humidity: "); Serial.print(humidity.relative_humidity); Serial.println("% rH");
 

}

void setup() {
  Serial.begin(115200);
  
  // Start I2C communication with the Multiplexer
  Wire.begin();

  TCA9548A(0);
  if (!aht1.begin()){
      Serial.println("Could not finid AHT10 sensor on bus 0, check wiring!");
  }
  Serial.println();

}

void loop() { 

  Serial.print("Free internal heap: ");
  Serial.println(ESP.getFreeHeap());
  //Print values for sensor 1 on bus 0
  printValues(aht1,0);

  delay(5000); 
}

I tried to use the debugger, but that also gives me an error message:
//debugger
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Error: unable to open ftdi device with description '', serial '' at bus location ''
C:/Users/
/AppData/Local/Arduino15/packages/esp32/tools/openocd-esp32/v0.12.0-esp32-20250707/bin/../share/openocd/scripts/target/esp_common.cfg:9: Error:
Traceback (most recent call last):
File "C:/Users/
*/AppData/Local/Arduino15/packages/esp32/tools/openocd-esp32/v0.12.0-esp32-20250707/bin/../share/openocd/scripts/target/esp_common.cfg", line 9, in script
[2026-01-04T16:44:22.157Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...
// end debugger

Thanks to all for any suggestions,
BM

Does that line compile?

From the header file definition

  bool getEvent(sensors_event_t *);

I don't see how it can.

There are three classes defined in the library, Adafruit_AHT10, Adafruit_AHT10_Humidity, and Adafruit_AHT10_Temp. Adafruit_AHT10 has the following definition:

   bool getEvent(sensors_event_t *humidity, sensors_event_t *temp);

Ah, that makes more sense, thank you!

It may not be the issue here and its a minor discrepancy, but:

`void printValues(Adafruit_AHT10 aht, int bus) {`

in order to be consistent with the call on the following line to:

`void TCA9548A(uint8_t bus){`

perhaps ought to be:

`void printValues(Adafruit_AHT10 aht, uint8_t bus) {`

and;

Wire.write(1 << bus); 

also for consistency might more appropriately be changed to:

Wire.write(1U << bus); 

Because of the way that it might be represented, a signed zero can sometimes produce unpredictable results when cast to an unsigned variable.