Godot Version
4.4
Question
why is this happening
Its exactly what the error is telling you.
CollisionShape2D
is a built in class.
You should not use it as a variable name.
When you create @onready variables the easiest way is to left click on the node and drag it into the code editor, then hold ctrl while dropping the node.
This will create a properly typed and pathed @onready variable such as:
@onready var collision_shape_2D:CollisionShape2D = $CollisionShape2D
In any case the format is
@onready var {variable name} {:variable type specifier} = {node path}