Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class "Facades\Statamic\Fields\FieldsetRepository" not found at Fields.php:221 #87

Open
fitzage opened this issue Feb 2, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@fitzage
Copy link

fitzage commented Feb 2, 2022

I’ve been having a sporadic issue when building one of my sites on Netlify. I finally got it to happen locally so I have the full laravel log. It’s two errors, but they always seem to come together. The first one happens early in the build process, and the other happens toward the end. I assume the first one is what triggers the second problem. Initially I didn’t notice the first error because it doesn’t immediately cause the failure.

[2022-02-02 20:21:14] local.ERROR: Class "Facades\Statamic\Fields\FieldsetRepository" not found {"exception":"[object] (Error(code: 0): Class \"Facades\\Statamic\\Fields\\FieldsetRepository\" not found at /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Fields.php:221)
[stacktrace]
#0 /Users/fitzage/Source/mexv3/vendor/spatie/blink/src/Blink.php(279): Statamic\\Fields\\Fields->Statamic\\Fields\\{closure}()
#1 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Support/Blink.php(18): Spatie\\Blink\\Blink->once('blueprint-impor...', Object(Closure))
#2 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Statamic\\Support\\Blink->__call('once', Array)
#3 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Fields.php(244): Illuminate\\Support\\Facades\\Facade::__callStatic('once', Array)
#4 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Fields.php(179): Statamic\\Fields\\Fields->getImportedFields(Array)
#5 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Fields.php(172): Statamic\\Fields\\Fields->createFields(Array)
#6 [internal function]: Statamic\\Fields\\Fields->Statamic\\Fields\\{closure}(Array, 0)
#7 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(677): array_map(Object(Closure), Array, Array)
#8 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(351): Illuminate\\Support\\Collection->map(Object(Closure))
#9 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Fields.php(173): Illuminate\\Support\\Collection->flatMap(Object(Closure))
#10 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Fields.php(34): Statamic\\Fields\\Fields->resolveFields()
#11 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Fields.php(23): Statamic\\Fields\\Fields->setItems(Array)
#12 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Blueprint.php(189): Statamic\\Fields\\Fields->__construct(Array)
#13 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(724): Statamic\\Fields\\Blueprint->Statamic\\Fields\\{closure}(Array, 'base')
#14 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Blueprint.php(192): Illuminate\\Support\\Collection->mapWithKeys(Object(Closure))
#15 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Blueprint.php(157): Statamic\\Fields\\Blueprint->addEnsuredFieldToContents(Array, Array)
#16 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Blueprint.php(143): Statamic\\Fields\\Blueprint->addEnsuredFieldsToContents(Array, Array)
#17 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Blueprint.php(125): Statamic\\Fields\\Blueprint->getContents()
#18 /Users/fitzage/Source/mexv3/vendor/spatie/blink/src/Blink.php(279): Statamic\\Fields\\Blueprint->Statamic\\Fields\\{closure}()
#19 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Support/Blink.php(18): Spatie\\Blink\\Blink->once('blueprint-conte...', Object(Closure))
#20 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Statamic\\Support\\Blink->__call('once', Array)
#21 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Blueprint.php(126): Illuminate\\Support\\Facades\\Facade::__callStatic('once', Array)
#22 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Blueprint.php(274): Statamic\\Fields\\Blueprint->contents()
#23 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Blueprint.php(493): Statamic\\Fields\\Blueprint->sections()
#24 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Fields/Blueprint.php(285): Statamic\\Fields\\Blueprint->validateUniqueHandles()
#25 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Data/AbstractAugmented.php(96): Statamic\\Fields\\Blueprint->fields()
#26 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Entries/AugmentedEntry.php(15): Statamic\\Data\\AbstractAugmented->blueprintFields()
#27 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Data/AbstractAugmented.php(34): Statamic\\Entries\\AugmentedEntry->keys()
#28 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Data/HasAugmentedInstance.php(16): Statamic\\Data\\AbstractAugmented->select(NULL)
#29 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Data/HasAugmentedInstance.php(21): Statamic\\Entries\\Entry->toAugmentedCollection(NULL)
#30 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/View/Cascade.php(166): Statamic\\Entries\\Entry->toAugmentedArray()
#31 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/View/Cascade.php(98): Statamic\\View\\Cascade->hydrateContent()
#32 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/View/View.php(164): Statamic\\View\\Cascade->hydrate()
#33 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/View/View.php(55): Statamic\\View\\View->cascade()
#34 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/View/View.php(84): Statamic\\View\\View->gatherData()
#35 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Http/Responses/DataResponse.php(154): Statamic\\View\\View->render()
#36 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Http/Responses/DataResponse.php(45): Statamic\\Http\\Responses\\DataResponse->contents()
#37 /Users/fitzage/Source/mexv3/vendor/statamic/cms/src/Entries/Entry.php(430): Statamic\\Http\\Responses\\DataResponse->toResponse(Object(Statamic\\StaticSite\\Request))
#38 /Users/fitzage/Source/mexv3/vendor/statamic/ssg/src/Page.php(40): Statamic\\Entries\\Entry->toResponse(Object(Statamic\\StaticSite\\Request))
#39 /Users/fitzage/Source/mexv3/vendor/statamic/ssg/src/Page.php(31): Statamic\\StaticSite\\Page->write(Object(Statamic\\StaticSite\\Request))
#40 /Users/fitzage/Source/mexv3/vendor/statamic/ssg/src/Generator.php(243): Statamic\\StaticSite\\Page->generate(Object(Statamic\\StaticSite\\Request))
#41 /Users/fitzage/Source/mexv3/vendor/spatie/fork/src/Task.php(92): Statamic\\StaticSite\\Generator->Statamic\\StaticSite\\{closure}()
#42 /Users/fitzage/Source/mexv3/vendor/spatie/fork/src/Fork.php(154): Spatie\\Fork\\Task->execute()
#43 /Users/fitzage/Source/mexv3/vendor/spatie/fork/src/Fork.php(128): Spatie\\Fork\\Fork->executeInChildTask(Object(Spatie\\Fork\\Task), Object(Spatie\\Fork\\Connection))
#44 /Users/fitzage/Source/mexv3/vendor/spatie/fork/src/Fork.php(103): Spatie\\Fork\\Fork->forkForTask(Object(Spatie\\Fork\\Task))
#45 /Users/fitzage/Source/mexv3/vendor/spatie/fork/src/Fork.php(182): Spatie\\Fork\\Fork->runTask(Object(Spatie\\Fork\\Task))
#46 /Users/fitzage/Source/mexv3/vendor/spatie/fork/src/Fork.php(76): Spatie\\Fork\\Fork->startRunning(Object(Spatie\\Fork\\Task), Object(Spatie\\Fork\\Task), Object(Spatie\\Fork\\Task), Object(Spatie\\Fork\\Task))
#47 /Users/fitzage/Source/mexv3/vendor/spatie/fork/src/Fork.php(69): Spatie\\Fork\\Fork->waitFor(Object(Spatie\\Fork\\Task), Object(Spatie\\Fork\\Task), Object(Spatie\\Fork\\Task), Object(Spatie\\Fork\\Task))
#48 /Users/fitzage/Source/mexv3/vendor/statamic/ssg/src/ConcurrentTasks.php(18): Spatie\\Fork\\Fork->run(Object(Closure), Object(Closure), Object(Closure), Object(Closure))
#49 /Users/fitzage/Source/mexv3/vendor/statamic/ssg/src/Generator.php(185): Statamic\\StaticSite\\ConcurrentTasks->run(Object(Closure), Object(Closure), Object(Closure), Object(Closure))
#50 /Users/fitzage/Source/mexv3/vendor/statamic/ssg/src/Generator.php(91): Statamic\\StaticSite\\Generator->createContentFiles()
#51 /Users/fitzage/Source/mexv3/vendor/statamic/ssg/src/Commands/StaticSiteGenerate.php(60): Statamic\\StaticSite\\Generator->generate()
#52 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Statamic\\StaticSite\\Commands\\StaticSiteGenerate->handle()
#53 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#54 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#55 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#56 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#57 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call(Array)
#58 /Users/fitzage/Source/mexv3/vendor/symfony/console/Command/Command.php(298): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#59 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#60 /Users/fitzage/Source/mexv3/vendor/symfony/console/Application.php(1015): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#61 /Users/fitzage/Source/mexv3/vendor/symfony/console/Application.php(299): Symfony\\Component\\Console\\Application->doRunCommand(Object(Statamic\\StaticSite\\Commands\\StaticSiteGenerate), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#62 /Users/fitzage/Source/mexv3/vendor/symfony/console/Application.php(171): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#63 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#64 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#65 /Users/fitzage/Source/mexv3/please(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#66 {main}
"} 
[2022-02-02 20:22:25] local.ERROR: Cannot access offset of type string on string {"exception":"[object] (TypeError(code: 0): Cannot access offset of type string on string at /Users/fitzage/Source/mexv3/vendor/statamic/ssg/src/Generator.php:268)
[stacktrace]
#0 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(765): Statamic\\StaticSite\\Generator->Statamic\\StaticSite\\{closure}(Object(Illuminate\\Support\\Collection), '', 0)
#1 /Users/fitzage/Source/mexv3/vendor/statamic/ssg/src/Generator.php(269): Illuminate\\Support\\Collection->reduce(Object(Closure), Object(Illuminate\\Support\\Collection))
#2 /Users/fitzage/Source/mexv3/vendor/statamic/ssg/src/Generator.php(187): Statamic\\StaticSite\\Generator->outputResults(Object(Illuminate\\Support\\Collection))
#3 /Users/fitzage/Source/mexv3/vendor/statamic/ssg/src/Generator.php(91): Statamic\\StaticSite\\Generator->createContentFiles()
#4 /Users/fitzage/Source/mexv3/vendor/statamic/ssg/src/Commands/StaticSiteGenerate.php(60): Statamic\\StaticSite\\Generator->generate()
#5 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Statamic\\StaticSite\\Commands\\StaticSiteGenerate->handle()
#6 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#7 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#8 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#9 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#10 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\\Container\\Container->call(Array)
#11 /Users/fitzage/Source/mexv3/vendor/symfony/console/Command/Command.php(298): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#12 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#13 /Users/fitzage/Source/mexv3/vendor/symfony/console/Application.php(1015): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#14 /Users/fitzage/Source/mexv3/vendor/symfony/console/Application.php(299): Symfony\\Component\\Console\\Application->doRunCommand(Object(Statamic\\StaticSite\\Commands\\StaticSiteGenerate), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#15 /Users/fitzage/Source/mexv3/vendor/symfony/console/Application.php(171): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#16 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#17 /Users/fitzage/Source/mexv3/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#18 /Users/fitzage/Source/mexv3/please(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#19 {main}
"} 
@jasonvarga
Copy link
Member

I could never understand why these happen. That's a realtime facade, so it should just get created on the fly. 🤔

@fitzage
Copy link
Author

fitzage commented Feb 2, 2022

I do notice that there was apparently a similar error for Static Cache warming that’s long since been fixed. Not sure if that is at all instructive. statamic/cms#4082

@fitzage
Copy link
Author

fitzage commented Feb 14, 2022

Sometimes I get this instead: Class "Facades\Statamic\View\Cascade" not found

I’m putting it here because it seems to be related in that it’s not the same error, but it could be a similar source, since it’s something that makes zero sense.

@fitzage
Copy link
Author

fitzage commented Feb 17, 2022

Could this be related to the multithreading with PHP 8? Like one thread gets ahead of something else?

@jasonvarga
Copy link
Member

Could be

@ncla
Copy link

ncla commented Feb 22, 2022

I am experiencing the same with FieldsetRepository class, I submitted support ticket about this, apologies for duplicating concern.

I have seen two variations for this on my Netlify builds:

1:34:18 PM:    Error
1:34:18 PM:   Class "Facades\Statamic\Fields\FieldsetRepository" not found
1:34:18 PM:   at vendor/statamic/cms/src/Fields/Fields.php:221
1:34:18 PM:     217▕     {
1:34:18 PM:     218▕         $blink = 'blueprint-imported-fields-'.md5(json_encode($config));
1:34:19 PM:     219▕
1:34:19 PM:     220▕         return Blink::once($blink, function () use ($config) {
1:34:19 PM:   ➜ 221▕             if (! $fieldset = FieldsetRepository::find($config['import'])) {
1:34:19 PM:     222▕                 throw new \Exception("Fieldset {$config['import']} not found.");
1:34:19 PM:     223▕             }
1:34:19 PM:     224▕
1:34:19 PM:     225▕             $fields = $fieldset->fields()->all();
1:34:19 PM:       +6 vendor frames 
1:34:19 PM:   7   [internal]:0
1:34:19 PM:       Statamic\Fields\Fields::Statamic\Fields\{closure}()
1:34:19 PM:       +74 vendor frames 
1:34:19 PM:   82  please:37
1:34:19 PM:       Illuminate\Foundation\Console\Kernel::handle()

and on Jan 11 deploy there was this

10:20:33 AM:    Error
10:20:33 AM:   Class "Facades\Statamic\Fields\FieldtypeRepository" not found
10:20:33 AM:   at vendor/statamic/cms/src/Fields/Field.php:75
10:20:33 AM:      71▕     }
10:20:33 AM:      72▕
10:20:33 AM:      73▕     public function fieldtype()
10:20:33 AM:      74▕     {
10:20:33 AM:   ➜  75▕         return FieldtypeRepository::find($this->type())->setField($this);
10:20:33 AM:      76▕     }
10:20:33 AM:      77▕
10:20:33 AM:      78▕     public function display()
10:20:33 AM:      79▕     {
10:20:33 AM:       +40 vendor frames 
10:20:33 AM:   41  please:37
10:20:33 AM:       Illuminate\Foundation\Console\Kernel::handle()

@artemverbo
Copy link

Hi everyone! Can confirm the issue exists only when using multiple workers, single worker php please ssg:generate works fine.

@tao
Copy link
Contributor

tao commented Apr 16, 2022

I also just got a Cascade not found but on Github Actions trying to deploy my static website:

Generating /podcasts/with-carla-episode-15
   Error 

  Class "Facades\Statamic\View\Cascade" not found
  at vendor/statamic/ssg/src/Generator.php:385
    382▕     protected function updateCurrentSite($site)
    383▕     {
    384▕         Site::setCurrent($site->handle());
  ➜ 385▕         Cascade::withSite($site);
    386▕ 
    387▕         // Set the locale for dates, carbon, and for the translator.
    388▕         // This is what happens in Statamic's Localize middleware.
    389▕         setlocale(LC_TIME, $site->locale());

@mbryne
Copy link

mbryne commented Jul 25, 2022

Just a heads up I have been getting a lot of these errors when deploying to Laravel Vapor.

Having this is in my php artisan statamic:stache:warm in my deploy steps would throw a significant amount of errors in the small gap between deploying and the stache being warmed.

Removing the warming of the stache solved the issue.

@nareshkvs
Copy link

Upgraded statamic, laravel versions to 3.3.* and 9.34 in staging and prod applications. It's working in staging but in prod, i'm facing this issue. Did any one explain what exctly is the reason and solution to this issue.

@duncanmcclean duncanmcclean added the bug Something isn't working label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants