I opened a .png file I had in GIMP and started editing it. The image was only black and some transparency. I selected the paint bucket tool, chose white as my color but when I fill in anything it is black.
To all those, like me, who did not find a solution by changing the mode to RGB....
The problem could be that the image has an embedded color profile that is somehow messing with how GIMP acts on the image. The solution is as follows: Image > Color Management > Discard Color Profile
This will force GIMP to use its own built-in sRGB color profile.
Furthermore, it is advisable to set GIMP to forewarn you of such situations. Select: Edit > Preferences > Interface > Dialog Defaults > Color Profile Import Dialog > Ask what to do.
This option is on by default but many people disable it from the "Don't ask me again" tick box and forget all about it!