This error message indicates that you are trying to write or "flash" software to a partition while your device's bootloader is still locked. In most Android-based devices, the bootloader must be explicitly unlocked before it will allow any manual changes to the system files. Phase 1: Enable OEM Unlocking

Enable Developer Options: Go to Settings > About Phone and tap the Build Number (or MIUI version for Xiaomi) 7 times.

What It Means:

This error occurs when you try to perform an operation (e.g., flashing firmware, writing data, or modifying a device) while the device’s flash lock flag is enabled. The “39” likely refers to a specific error code from the tool or device firmware.

Common devices that enforce this flag include:

If you are trying to flash a custom ROM, update your firmware, or unbrick your device using Fastboot, seeing the error "FAILED (remote: 'flashing lock flag is locked. please unlock it first')" can be a major roadblock.

# Install mtkclient
git clone https://github.com/bkerler/mtkclient
cd mtkclient
pip install -r requirements.txt

Dismiss Got it. On this page. Get into the bootloader. Unlock the bootloader. Lock the bootloader. Set lock and unlock properties. Android Open Source Project

7.3 Use Verified Boot (AVB) Aware Flashing

If you flash custom images, also disable Android Verified Boot (AVB) by flashing an empty vbmeta: