I talked about this for a while with Duncan today on Discord. When I merge changes that the Git integration commited on the production branch to my develop repo I almost always get the error:
Call to a member function id() on null
The fix is usually a php artisan cache:clear, but this is pretty annoying as this usually happens multiple times a day. I feel it's bad for new comers as the error is vague and it doesn't present a solution. I can imagine this making v3 feel unstable.
I just triggered this error and I noticed the following stuff changed on the production branch:
Statamic 3.0.32 Pro
Laravel 8.17.0
PHP 7.4.10
edalzell/forma 0.7.2
jonassiewertsen/statamic-livewire 2.2.0
silentz/mailchimp 2.4.1
Install method (choose one):
I could test different events some time to see what triggers it and what not. Let me know if that's welcome.
It's definitely not specific to the git integration, but probably more to how git works (it creates/deletes files which are not in the Stache). I get this error literally every time I switch branches when working locally. I am also willing to pitch on to help testing/debugging if appreciated.
Agreed. Don't think the git integration itself is the issue. But the branch switching/merging def. craps on the stache somehow.
Do you have watcher enabled in config/statamic/stache.php?
It’s off on production and on locally.
Same for me, also off on production and on locally.
I've also came across this issue numerous times before and it's a real pain, especially for those where it causes issues in a production environment when they deploy.
I have this same issue, but for this site I am not using the pro version (yet). Getting this error message:
[2020-12-27 18:56:09] production.ERROR: Call to a member function id() on null {"exception":"[object] (Error(code: 0): Call to a member function id() on null at /home/forge/test.lekst.nl/vendor/statamic/cms/src/Stache/Stores/Store.php:79
I have this same issue, but for this site I am not using the
proversion (yet). Getting this error message:
[2020-12-27 18:56:09] production.ERROR: Call to a member function id() on null {"exception":"[object] (Error(code: 0): Call to a member function id() on null at /home/forge/test.lekst.nl/vendor/statamic/cms/src/Stache/Stores/Store.php:79
Does clearing your cache fix the issue for you?
No it doesn't.
On Sun, 27 Dec 2020, 20:08 Duncan McClean, notifications@github.com wrote:
I have this same issue, but for this site I am not using the pro version
(yet). Getting this error message:[2020-12-27 18:56:09] production.ERROR: Call to a member function id() on
null {"exception":"[object] (Error(code: 0): Call to a member function id()
on null at /home/forge/
test.lekst.nl/vendor/statamic/cms/src/Stache/Stores/Store.php:79Does clearing your cache fix the issue for you?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/statamic/cms/issues/2967#issuecomment-751504756, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AABLFBHDV7GT3DDKSQVX5N3SW6A2ZANCNFSM4UNGCYZQ
.
My client is reporting 500 error's on production as well so I had to give them access to the cache utility. It's hard to get useful information from them on when it craps out, but if you're interested in this site as a test case. It might also help debug the performance issues without caching as mentioned here #2704.
Has anyone got a decent work around for this?
Hi, I had a very similar issue.
Call to a member function id() on null at
.../vendor/statamic/cms/src/Stache/Stores/Store.php:79)
Juste like @robdekort mentionne, the simple cache command php artisan cache:clear, normally work in most usecase _Call to a member function id() on null._
Basically, I had duplicate entries in one of the collections. Some entries where dated and not the other. I removed the undesires entries and clear cache again: php artisan cache:clear.

Here's how I fixed my issue.
_content. This should remove the error. Hope that can help.
Statamic 3.0.42 Pro
Laravel 8.26.1
PHP 7.4.12
No addons installed
Duncan has a nice little script to identify duplicates if it happens again @SimonMauvaisGarcons: https://gist.github.com/duncanmcclean/8124d22cd4685d76d37aeb0cc0871db8
Most helpful comment
Duncan has a nice little script to identify duplicates if it happens again @SimonMauvaisGarcons: https://gist.github.com/duncanmcclean/8124d22cd4685d76d37aeb0cc0871db8