XIAO_ESP32 Classic Bluetooth pairing

I am trying to write a classic bluetooth app using my new xiao_esp32 device. I just have a basic shell at the moment to see what I can do with it, and for some reason I get an error when I try to pair it on my android phone.

The code is:

#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>

#define SERVICE_UUID        "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"


class MyCallbacks: public BLECharacteristicCallbacks {
    void onWrite(BLECharacteristic *pCharacteristic) {
    std::string value = pCharacteristic->getValue();

  if (value.length() > 0) {
    Serial.println("*********");
    Serial.print("New value: ");
    for (int i = 0; i < value.length(); i++)
      Serial.print(value[i]);

    Serial.println();
    Serial.println("*********");
  }
}
};

void setup() {
Serial.begin(115200);

BLEDevice::init("MyESP32");
BLEServer *pServer = BLEDevice::createServer();

BLEService *pService = pServer->createService(SERVICE_UUID);

BLECharacteristic *pCharacteristic = pService->createCharacteristic(
                                     CHARACTERISTIC_UUID,
                                     BLECharacteristic::PROPERTY_READ |
                                     BLECharacteristic::PROPERTY_WRITE
                                   );

pCharacteristic->setCallbacks(new MyCallbacks());

pCharacteristic->setValue("Hello World");
pService->start();

BLEAdvertising *pAdvertising = pServer->getAdvertising();
pAdvertising->start();
}

void loop() {
// put your main code here, to run repeatedly:
delay(2000);
}

and the error I get is:

E (348408) BT_SMP: smp_calculate_link_key_from_long_term_key failed to update link_key. Sec Mode = 2, sm4 = 0x00
E (348408) BT_SMP: smp_derive_link_key_from_long_term_key failed

E (348414) BT_BTM: btm_proc_smp_cback received for unknown device
E (348451) BT_BTM: BTM_GetSecurityFlags false

E (348452) BT_BTM: BTM_GetSecurityFlags false

E (348452) BT_BTM: BTM_GetSecurityFlags false

E (348721) BT_BTM: BTM_GetSecurityFlags false

E (348811) BT_BTM: BTM_GetSecurityFlags false

E (348909) BT_BTM: BTM_GetSecurityFlags false

E (348953) BT_BTM: BTM_GetSecurityFlags false

E (348969) BT_BTM: BTM_GetSecurityFlags false

E (348984) BT_BTM: BTM_GetSecurityFlags false

E (349021) BT_BTM: BTM_GetSecurityFlags false

E (349036) BT_BTM: BTM_GetSecurityFlags false

E (349051) BT_BTM: BTM_GetSecurityFlags false

I don’t know if this is the correct place to submit this, if not I will ask elsewhere.

I have verified my bluetooth permissions on the phone app, it is the same if I just try to pair with the phone without my app. Seems like I am missing something, I just can’t see it yet.