After a texture handle is generated the texture is immutable.
That means you can’t reallocate its storage or change its state, but you can still update its content.
I think this error applies to you:
The error INVALID_OPERATION is generated by TexImage*, CopyTexImage*,
CompressedTexImage*, TexBuffer*, TexParameter*, as well as other functions
defined in terms of these, if the texture object to be modified is
referenced by one or more texture or image handles.
You want to use glTexSubImage2D or glTextureSubImage2D.
I also suggest immutable storage + DSA as better texture APIs in general.