Strapi /auth/local api throws 500 error for wrong password or email not confirmed

making sure all strapi related dependency packages have same version number .

find the latest stable version number of strapi from npm. update all the @strapi related package to the same version in package.json .
remove package-lock json
remove cache,build files
run npm install
start the backend again with npm run develop.

this solved the issue for me