This bit of Gremlin demonstrates both problems for uses of by(String):
java.util.LinkedHashMap cannot be cast to org.apache.tinkerpop.gremlin.structure.Element
Type ':help' or ':h' for help.
Display stack trace? [yN]n
First, users typically expect this to work because they figure they are just grabbing a keys value from a Map and then get the difficult to understand message which doesn't tell you how to resolve. As a side note, the way to resolve is with: