The load() command in the mongo shell does not currently support expansion of ~ paths to the current user's home directory:
From the error message it's not entirely obvious why ~ doesn't work. The expectation is that ~ would expand to the equivalent of $HOME similar to shells like bash/zsh (i.e. "/home/user/foo.js").
Tilde paths would be useful for writing mongorc.js add-ins that can load from the user's current path. For scripting purposes, it may also be helpful to expose a getter for the $HOME directory path (eg. getHomePath()).