laravel/framework · error · EntityNotFoundException
Queueable entity [%s] not found for ID [%s].
Error message
Queueable entity [%s] not found for ID [%s].
What it means
QueueEntityResolver::resolve() loads (new $type)->find($id) when the queue worker needs the model that was serialized by reference. If the row no longer exists (deleted between dispatch and processing), find() returns null and EntityNotFoundException is thrown with the type and id. This surfaces as the job failing because its payload model disappeared.
Source
Thrown at src/Illuminate/Database/Eloquent/QueueEntityResolver.php:27
{
/**
* Resolve the entity for the given ID.
*
* @param string $type
* @param mixed $id
* @return mixed
*
* @throws \Illuminate\Contracts\Queue\EntityNotFoundException
*/
public function resolve($type, $id)
{
$instance = (new $type)->find($id);
if ($instance) {
return $instance;
}
throw new EntityNotFoundException($type, $id);
}
}
View on GitHub (pinned to bd6b5437e6)
Solutions
- In the job's handle(), catch ModelNotFoundException/EntityNotFoundException and fail gracefully or skip.
- Serialize full model data instead of a reference when the job does not need a live row, or pass the id and re-fetch with withTrashed()/fail() defensively.
- Avoid deleting referenced entities while jobs are pending, or mark them as in-use until jobs complete.
Example fix
// before
class SendReport implements ShouldQueue {
public function __construct(public User $user) {}
public function handle() { $this->user->notify(...); } // throws if deleted
}
// after
class SendReport implements ShouldQueue {
public function __construct(public User $user) {}
public function handle() {
$user = User::withTrashed()->find($this->user->id)
?? throw new ModelNotFoundException;
$user->notify(...);
}
} Defensive patterns
Strategy: try-catch
Validate before calling
// Verify the referenced entity still exists before the job runs (best-effort)
if (! (new $type)->whereKey($id)->exists()) {
throw new \Illuminate\Contracts\Queue\EntityNotFoundException($type, $id);
} Try / catch
try {
$model->notify(...);
} catch (\Illuminate\Contracts\Queue\EntityNotFoundException $e) {
// log and release/fail gracefully
report($e);
return;
} Prevention
- Fetch models inside handle() with withTrashed()/fail() defensively.
- Avoid deleting entities referenced by queued jobs until they complete.
- Prefer passing ids over model references when data may change.
When it happens
Trigger: Dispatching a queued job/closure/mailable that serializes a model by id (SerializesModels), then the model is deleted (force-deleted, or soft-deleted and the job expects it) before the worker picks it up.
Common situations: Race between an edit/delete and a queued notification; soft-deleted models fetched without withTrashed in the job; jobs that outlive their referenced data; tests that dispatch then truncate tables.
Related errors
- Queueing collections with multiple model types is not suppor
- Queueing collections with multiple model connections is not
- Ably error: %s
- Queue resolver did not return a Queue implementation.
- Attempted to batch job [%s], but it does not use the Batchab
AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06).
Data as JSON: /data/errors/228bdaccce42b1a7.json.
Report an issue: GitHub.