Error "User is not set"

I have occasionally seen this error on some installations when performing command-line operations like cache-clear recently. I don’t really see a pattern, unfortunately, and can’t find anything in the Grav repo. It happens both on installations with Login/Admin plugins and without.

Here’s what I see in the logs:

2023-08-01 04:28:40 [CRITICAL] User is not set.

and here is the output to bin/grav cache-clear:

In AbstractTransportFactory.php line 46:                                                                                                                                
  User is not set.                                                                                                                                                      
cache [--invalidate] [--purge] [--all] [--assets-only] [--images-only] [--cache-only] [--tmp-only] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--env [ENV]] [--lang [LANG]] [--] <command>

AbstractTransportFactory seems to be a Symfony mailer class but that has so far not helped me track this down. I have recently started using the new mail plugins. That could be a pattern. The mailers work.

The sites serve content just fine.

I’ll appreciate any clues. Please let me know if I can provide any more information.

@hughbris, I can only find a reference to ‘User is not set’ and class AbstractTransportFactory inside directory /vendor of the Email plugin.

But you’ll probably have found that out already…

And I have no idea why $ bin/grav cache would run any code from the Email plugin.

The Email Plugin is currently under development or at least was updated recently so chances are that a new issue in the GitHub repository will get noted by it’s developer.

I don’t feel like it’s convincing enough that this plugin is the source of the problem. I would like to have more confidence before submitting an issue.

[Edit: This was in response to @bleutzinn’s post immediately before. Not sure why but the ‘system’ user removed the quote context … “something something whole post”]

You’d think! I didn’t find the “User is not set” for some reason, I think because I got distracted by the results of searching for “AbstractTransportFactory”.

My ignorant guess has been that this comes up from some sort of system bootstrapping before the cache is cleared. Pretty much spitballing though.

Having typed that out, I realised I should try uninstalling the email plugins. Yes, the error went away! Reinstalled them and it came back. So I guess I’ll dig a little further in the morning here and think about putting together a coherent issue. Thank you @pamtbaau for indirectly getting me to try that.

Issue added to the email plugin repo now. I don’t think there’s anything new to see there.