How to tell: GIMP can handle three different color modes: RGB(A), Grayscale and Indexed. The indexed color mode uses a colormap, where all colors used in the image are indexed. The color picker in GIMP however, lets you choose RGB colors. That means, if you try to paint with a different color than is indexed in the colormap, you can end up with the wrong color.
How to fix: If possible, use the RGB color mode to paint on images. You can verify and select another color mode from the Mode menuitem in the menu. If you need to use indexed mode you can pick the color you want to use from the Colormap Dialog.