automatic weighting flips model

When ever i apply automatic weights this character, he flips on his back

before adding automatic weights

After applying automatic weights
please help.

Please note that I intend to use this Character as an avatar for VRchat and need/would like it to be humanoid.
here is the blend file
korikakumonupgrade.3.blend (448 KB)

You’re parenting it with armature in pose mode, while it should be done between objects, in object mode. Getting automatic weights to selected bones is possible but you don’t do it like that. Parenting is not a requirement for armature deform to work, it works with the armature modifier, and weight paint has automatic weighting for selected bones that you select in pose mode.

There are duplicate objects for most of the mesh type objects, overlapping each other. Object transforms are off. The armature has an unapplied scale, and all meshes are parented to a scaled and rotated empty.

Delete the duplicates. Select all objects, ctrl+A -> rotation and scale. Select the mesh objects and armature, with armature being the active, and ctrl+P -> with automatic weights. The meshes are then parented to the armature instead of the empty. If it’s significant to have the empty with 90 degree rotation for some reason, you could rotate it back and then parent the others to it.