psalm icon indicating copy to clipboard operation
psalm copied to clipboard

EUncaught Exception: InvalidArgumentException Could not get class storage

Open tasselchof opened this issue 4 years ago • 8 comments

When I am scanning project with just initialized Psalm I am getting this exception:

./bin/psalm
Target PHP version: 7.3 (inferred from composer.json)
Scanning files...
Analyzing files...

░░░░░░░░░░░EEE░░░EEE░░░░░░░░░E░░░░░░░EEEE░░E░░E░░E░░░E░░EE░░  60 / 844 (7%)
░E░░░░░░░░░E░░E░░░E░░░░░░░E░░E░E░░░░░E░E░░░E░░░░░░░░EE░░░░E░ 120 / 844 (14%)
░E░E░E░E░E░░E░░░░░░░░░░░░░░░░░░░░░░░░E░E░░░░░EUncaught Exception: InvalidArgumentException Could not get class storage for application\controller\consoletaskscontroller
Emitted in /home/dev/domains/a/vendor/vimeo/psalm/src/Psalm/Internal/Provider/ClassLikeStorageProvider.php:46

What this might be?

tasselchof avatar Jan 30 '22 08:01 tasselchof

Are you using intersections in native types in your project?

Can you run psalm with --debug-by-line and check the last path before it crashes? It should show us the trigger code

orklah avatar Jan 30 '22 08:01 orklah

It didn't crushed with this line which is weird.

tasselchof avatar Jan 30 '22 09:01 tasselchof

Ok, --debug-by-line has a side effect because it makes Psalm run on only 1 thread. That in itself could solve your issue if it's related to threads. Can you try without --debug-by-line but with --threads=1 ?

orklah avatar Jan 30 '22 09:01 orklah

Do I need to clear cache or whatever? It's going through just imply running ./bin/psalm. I wanna try to find what was that - if it is a bug.

tasselchof avatar Jan 30 '22 09:01 tasselchof

I did not understand your answer. What was the result of --threads=1? Did it pass?

orklah avatar Jan 30 '22 10:01 orklah

Yes, it is passing. As well as ./bin/psalm is passing now. But it was not passing earlier.

tasselchof avatar Jan 30 '22 10:01 tasselchof

oh, ok. It might be cache related indeed. Does it pass after a --clear-global-cache and then with --no-cache?

orklah avatar Jan 30 '22 10:01 orklah

I suspect this can be closed as fixed by https://github.com/vimeo/psalm/pull/10856

cabbey avatar Jul 23 '24 22:07 cabbey

I'll close this, no response from author and with additional fixes added with threads, this report is obsolete now

orklah avatar Feb 05 '25 20:02 orklah