when I try a scp transfer I get this error:
protocol error: bad mode
PD: I can establish a ssh connection.
So, this is a bit of question necromancy, but since I got here, and then realised what the answer was after reading the first answer, I figured I'd put this here for other wayward souls.
Because of the way scp works (over stdin/stdout over ssh AFAIK), having a naive bashrc that prints messages breaks the formatting scp is expecting, and thus the connection.
As suggested in various answers elsewhere (linked below), modifying your dot-files is usually the way to fix this: