What does a lexer do with invalid tokens during lexical analysis?

If a lexer encounters invalid tokens during lexical analysis, it typically reports an error to indicate that the input does not conform to the expected lexical rules. This error indicates to the programmer that there is a problem with the source code that needs to be addressed before the compilation can proceed further.