How to track down source of "Latest compiled component path not found" error #7934
-
I'm having a bit of trouble figuring out what could be the cause of the following error:
which points to this function in
Any time I log anything within this function nothing get's logged as if it doesn't even touch this and I don't fully understand how it gets to this function for me to reproduce. If I understand correctly this is a method used to actually generate the key for the component if it hasn't been created yet. So it uses the lastPath to the view to generate a key and when this hasn't been set it will throw an exception. Livewire seems to intercept blade when it's compiling a view and takes the path to it and sets that as the lastPath. The interception looks like this:
This is where I'm a bit lost on what's going on, what could possibly cause the interception to fail and not set the lastPath? If something went wrong when rendering the blade view why would it keep executing the logic to generate a key? Mainly looking for help on how to reproduce this or get a deeper understanding of what's going on so that i can figure out which part of my components are causing this exception. For context the project i'm working on has been upgraded from v2 to v3 recently and I'm on v3.4.4 of livewire. |
Beta Was this translation helpful? Give feedback.
Replies: 16 comments 15 replies
-
I just randomly stumbled onto this as well. Did you figure out what was causing it? |
Beta Was this translation helpful? Give feedback.
-
I had this error when running pest-tests. |
Beta Was this translation helpful? Give feedback.
-
Same. I've got a custom <?php
declare(strict_types=1);
namespace Modules\Core\Commands;
use Illuminate\Console\Command;
class OptimizeAllCommand extends Command
{
protected $signature = 'optimize:all';
protected $description = 'Cache all the things!';
public function handle()
{
$this->components->info('Caching all the things...');
collect([
'config' => fn () => $this->callSilent('config:cache') == 0,
'events' => fn () => $this->callSilent('event:cache') == 0,
'filament' => fn () => $this->callSilent('filament:cache-components') == 0,
'icons' => fn () => $this->callSilent('icons:cache') == 0,
'routes' => fn () => $this->callSilent('route:cache') == 0,
'views' => fn () => $this->callSilent('view:cache') == 0,
])->each(fn ($task, $description) => $this->components->task($description, $task));
$this->newLine();
}
} Now when it gets to
I've been using this command for almost a year without problems. The odd thing is that running |
Beta Was this translation helpful? Give feedback.
-
Looks like it started breaking from version 3.4.0. |
Beta Was this translation helpful? Give feedback.
-
Could anyone make a PR with failing test so Caleb can take a look at it? This one is a bit beyond my skillset unfortunately. |
Beta Was this translation helpful? Give feedback.
-
I've pinpointed it to this commit: f521cfb |
Beta Was this translation helpful? Give feedback.
-
Having this issue too on an Ubuntu server, but cannot replicate locally in Mac OSX. Even running the same post deployment commands like view:cache etc. EDIT: I seem to get this error sometimes on my server if there is any errors whatsoever in Blade. For example reading properties on null. Fixing those issues stops this error showing, but I'm not sure if that's always the case. |
Beta Was this translation helpful? Give feedback.
-
same issue here. In my case I call a function all() which I assume is a reserved name. |
Beta Was this translation helpful? Give feedback.
-
I was running into this same issue on version 3.4.8 while following along with a Pest video course at Laracasts. It turns out the real error was getting lost and I couldn't see it till I downgraded to 3.3.5. That version told me that the Vite manifest was missing. I had never ran |
Beta Was this translation helpful? Give feedback.
-
Okay, I found the problem. When you run You can solve this by adding But how can you track which components don't have a key? You can open the file You can also use the search feature in VSCode, but it doesn't always find all components. EDIT: |
Beta Was this translation helpful? Give feedback.
-
I've run into this just now, only once upgrading to Laravel 11.x. Occurs on deploy in production when running |
Beta Was this translation helpful? Give feedback.
-
@maverik23 Adding a random key fixed it for me. Observation: After running |
Beta Was this translation helpful? Give feedback.
-
Use the The project I encounter the "Latest compiled component path not found"/DeterministicBladeKeys->Generate problem on is one that I converted from Laravel 10 to 11 via Laravel Shift. So, let me ask this: could this be something related to how Shift does the conversion, possibly injecting something "unusual" into how the pages are iterated over? |
Beta Was this translation helpful? Give feedback.
-
I didn't use Shift to upgrade from 10 to 11 - just upgraded the version constraints for Laravel/Sanctum. Perhaps we should be sharing our version numbers to find the pattern here. This discussion is old enough that I presume some people started running into this issue on Laravel 10? Edit: I've just realised that Laravel 11's |
Beta Was this translation helpful? Give feedback.
-
I managed to work out how to trigger this thanks to @JonathanLouw's steps (I didn't read it properly last time I tried to follow it and missed the nested component step) 🤦♂️ I have submitted a PR #8144 with a potential fix. |
Beta Was this translation helpful? Give feedback.
-
Hello, thanks for your efforts, I am facing the same issue, and the solution says use this code.. but where do I insert it? app('blade.compiler')->precompiler(function ($value) {
// $value is the contents currently being compiled...
app(DeterministicBladeKeys::class)->setCurrentBladeFile(
app('blade.compiler')->getPath() ?: $value,
);
return $value;
}); |
Beta Was this translation helpful? Give feedback.
@d2inco - can you try out this PR and see if it fixes the problem? #8167