This is a mistake I make from time to time to my own detriment when making ad-hoc changes. Take a large string usually cut and pasted from somewhere that you want to break into an array of lines:

$myList = "
ABC
CDE
EFG
HIJ"

The first thing that comes to mind:

$myArray = $myList -split "`n"

$myArray | %{
    "$($_)x"
}
x
ABCx
CDEx
EFGx
HIJx

Sure there's a blank line we need to remove but otherwise it seems fine right? Except those strings are really broken, and you'll know when you start using Test-Path and getting this error message:

Test-Path : Illegal characters in path.
At line:2 char:5
+     Test-Path $_
+     ~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (C:\Users\Cody Konior\:String) [Test-Path], ArgumentException
    + FullyQualifiedErrorId : ItemExistsArgumentError,Microsoft.PowerShell.Commands.TestPathCommand

The reason why lay in how long each string is.

$myArray | %{
    $_.Length
}
1
4
4
4
3

Each string is a little longer than it should be; except the first one which is a newline and the last one which is normal. Let's investigate a little closer what's at the end of that second entry (remembering arrays are 0 indexed).

($myArray[1][3]).ToByte([System.IFormatProvider]::Ascii)
# or
[byte]$myArray[1][3]
13
13

It's the carriage return characters of course! In my very first example I was meant to split by "rn" but I was being lazy and only stripped the `n. Which is why you should always type it out properly:

$myArray = $myList -split [Environment]::NewLine

$myArray | Where { $_ } | %{ 
    Test-Path $_
}
False
False
False
False

Another thing you can do is to just .Trim() each array entry before you use it. Or both. But it's funny how the error message doesn't really indicate what's going on, and making this little mistake at the end of a long day and trying to find it can drive anyone crazy.