The title-invalid-characters message is displayed when trying to read a title that contains invalid characters like | or ]. This can happen when copying a URL incorrectly like <https://www.mediawiki.org/wiki/Download>, or using invalid link syntax like https://www.mediawiki.org/wiki/Download|page.
It should be be possible to automatically suggest a title by checking whether a valid page exists at the given title up to the first invalid character. In the above examples, we would suggest Download.
The interface message sets $2 to the invalid title, so a naively we could attempt to parse this with templates/Lua and use {{#ifexist:}}. However, the value of $2 is not escaped, so it is not safe to pass into templates, as I tried here. ({{foo|$2}} with the invalid title Download|page expands to {{foo|Download|page}}, and there is no real way to escape the pipe. An invalid title like Download}}page will break it completely.)
A possible solution (suggested by @Legoktm) is for MediaWiki to set $3 to a suggested title (for now, the given title up to the first invalid character), and an interface message could simply use {{#ifexists:$3|Did you mean: [[:$3]]?}}.
See discussion at enwiki's village pump.