Oh, I had a similar problem today, had me going crazy... I’ve put new cables in before, but this time it was the cable housing !
I was unable to shift onto the large chainring, 0.7 miles into my ride.
The top end of the housing was undone,& would not fit back into the ferrule. Later I noticed the housing was split further down.
I guess it’s best to leave the shifter on the handlebars. I ruined a cable by kinking it, lucky I had several spares.
i have photos.
Cable Housing End Frayed (Shifter Cable)
Shifter Cable Housing Split