"Libpng: Wrote palette index exceeding num_palette" help please?

For some reason, I can’t adjust opacity on the layer I’m working on; I can make a layer with less opacity, but whenever I turn the opacity down or up on a layer, it does nothing. When I tried to circumvent the problem by making a transparent layer and then merge it down, the resulting image had no transparency; the bits from the transparent layer were rendered completely opaque.

I tried to save my work, and it gave me the error I mentioned in my title. I checked and apparently it saved anyway, but now the background is black and only half the transparent parts exist?

I searched for this error and there was one post from 2017 that mentioned it, but it didn’t ever seem to be resolved.

Please help.

Are you working in indexed mode instead of RGB mode? (Sprite -> Color Mode ->)

I checked and it is indexed mode; I have no idea what that means, but that does seem to have solved the problem. What does indexed mode even mean, and how did I end up in it?

Indexed mode means that each pixel, rather than having a fully defined 4-byte colour associated with it, is instead a 1-byte (or less) index into a palette (a set of colours) associated with the image. This allows files to be smaller (since colour information only needs to be stored once, rather than with each pixel), and allows for various pixel art-friendly workflows, such as easily swapping colours or palettes.
Most formats that support indexed mode limit the palette size to 256 colours (1 byte can only store indices 0-255), so your palette was probably above 256 colours.

As for how you ended up in that mode: you probably had “Indexed” selected as the Color Mode when you created your document, and not noticed. If you then created your palette by loading an RGB image or started with a smaller palette but then kept adding images, that could’ve given you the too-large palette. If you made your document by opening an RGB image, then your document should have stayed RGB, though it’s possible you accidentally changed it to Indexed through the menu somehow.