STM32f303RE, I2C, Voltage supply problem

Hello everyone,

I am trying to connect a Sensirion SCD41 CO2 sensor to my STM32f303RE board by using the i2c protocol in STCubeIDE. Whenever I try to run the Debug, I get this error message:

Error in final launch sequence:

Failed to start GDB server
Failed to start GDB server
Error in initializing ST-LINK device.
Reason: (4) No device found on target.

I only get this error message when every single pin is connected to the board. The thing is, when I upload the code without anything connected to the board, everything runs smoothly and perfectly. I suspect I have a problem with my connections. Here is a picture of my circuit:

I tried solving this by using an external power supple (4 volts) and a voltage regulator (3.3 volts) in order to leave the board alone. This solves the problem of uploading the code, however the transistor gets BURNINGLY hot within seconds, which tells me its eating up too much current. I am a brand new newbie in terms of i2c communication and stm32 microcontrollers by the way. Is there some obvious mistake i am doing? For the code i am using the example provided by the manufacturer in his website GitHub - Sensirion/embedded-i2c-scd4x: Embedded driver for the SCD4x sensor family. (of course, adapted to my board). I should mention, i tested the sensor using the arduino board and the library provided in the website GitHub - Sensirion/arduino-i2c-scd4x: Arduino library for Sensirion SCD4x sensors, and everything works fine with the arduino, so my sensor defenetily works.

are you using Mbed or STM32CubeIDE? When you use CubeMX, then this is the wrong forum.
The CubeMX disables SWD by default and sets the debug pins to IO, this must be changed in the CubeMX configuration,
Which transistor is getting hot? Have you checked the current consumption of the sensirion board?