{"id":"876cda228be1d98c","repo":"laravel/framework","slug":"managed-queue-name-does-not-exist","errorCode":null,"errorMessage":"Managed queue [{$name}] does not exist.","messagePattern":"Managed queue \\[(.+?)\\] does not exist\\.","errorType":"exception","errorClass":"ManagedQueueNotFoundException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Foundation/Cloud/QueueConnector.php","lineNumber":77,"sourceCode":"        $this->configureWorker($queue);\n        $this->configureFailedJobProvider($queue);\n\n        return $queue;\n    }\n\n    /**\n     * Register SQS client middleware that translates \"queue does not exist\" errors into ManagedQueueNotFoundExceptions.\n     */\n    protected function registerErrorHandling(SqsClient $sqs, Queue $queue): void\n    {\n        $sqs->getHandlerList()->appendSign(function (callable $handler) use ($queue) {\n            return function (CommandInterface $command, RequestInterface $request) use ($handler, $queue) {\n                return $handler($command, $request)->otherwise(function ($reason) use ($command, $queue) {\n                    if ($reason instanceof AwsException &&\n                        $reason->getAwsErrorCode() === 'AWS.SimpleQueueService.NonExistentQueue') {\n                        $name = $queue->normalizeQueue($command['QueueUrl'] ?? null);\n\n                        throw new ManagedQueueNotFoundException(\n                            \"Managed queue [{$name}] does not exist.\", 0, $reason,\n                        );\n                    }\n\n                    throw $reason;\n                });\n            };\n        }, 'managed-queue-not-found');\n    }\n\n    /**\n     * Configure the queue.\n     */\n    protected function configureQueue(Queue $queue): void\n    {\n        $this->app['events']->listen(fn (JobQueued $event) => $event->connectionName === $queue->getConnectionName()\n            ? $queue->finishQueueingJob($event->queue)\n            : null);","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Foundation/Cloud/QueueConnector.php#L59-L95","documentation":"Thrown as ManagedQueueNotFoundException (via QueueConnector::registerErrorHandling SQS-handler middleware) when an AWS SDK call returns error code AWS.SimpleQueueService.NonExistentQueue for a queue URL normalized through the Cloud Queue. The connector maps SQS's 'queue does not exist' error into a friendlier domain exception naming the managed queue. Fires on any SQS operation against an unprovisioned/renamed queue (send, receive, delete, change visibility).","triggerScenarios":"Dispatching a job (or a worker polling) on a cloud queue whose name resolves to an SQS QueueUrl that does not exist. Reached via dispatch(), the worker's receive loop, or any SQS client call wrapped by registerErrorHandling when the underlying queue was deleted/renamed/never provisioned.","commonSituations":"Queue name typo in config or job->onQueue(). Queue was deleted in the Cloud console or via infra-as-code teardown. Environment mismatch (production queue name used in staging where it isn't provisioned). Recent rename without updating config/queue.php connections.cloud.queue.","solutions":["Verify the queue name in config/queue.php (connections.cloud.queue or the per-job onQueue()) matches a provisioned Cloud-managed queue.","Provision the missing queue through the Cloud console / CLI.","Confirm you are targeting the correct environment (staging vs production queue sets).","Catch ManagedQueueNotFoundException and alert ops / fail the dispatch gracefully."],"exampleFix":"// before\nSomeJob::dispatch($payload)->onQueue('emails');\n// throws ManagedQueueNotFoundException if 'emails' is not provisioned\n\n// after\nuse Illuminate\\Foundation\\Cloud\\ManagedQueueNotFoundException;\n\ntry {\n    SomeJob::dispatch($payload)->onQueue('emails');\n} catch (ManagedQueueNotFoundException $e) {\n    report($e);\n    // fall back to a known-good queue or surface a clear ops alert\n    SomeJob::dispatch($payload)->onQueue(config('queue.connections.cloud.queue'));\n}","handlingStrategy":"try-catch","validationCode":"use Illuminate\\Support\\Facades\\Storage;\nuse Aws\\Sqs\\SqsClient;\n\n// Verify the queue exists before relying on it (optional, costs an API call):\n$sqs = app(SqsClient::class);\n$prefix = config('queue.connections.cloud.prefix');\n$queueName = config('queue.connections.cloud.queue');\ntry {\n    $sqs->getQueueUrl(['QueueName' => $queueName]);\n} catch (\\Aws\\Exception\\AwsException $e) {\n    if ($e->getAwsErrorCode() === 'AWS.SimpleQueueService.NonExistentQueue') {\n        throw new \\RuntimeException(\"Managed queue [{$queueName}] is not provisioned.\");\n    }\n    throw $e;\n}","typeGuard":"use Illuminate\\Foundation\\Cloud\\ManagedQueueNotFoundException;\n\nfunction isManagedQueueMissing(\\Throwable $e): bool {\n    return $e instanceof ManagedQueueNotFoundException;\n}","tryCatchPattern":"use Illuminate\\Foundation\\Cloud\\ManagedQueueNotFoundException;\n\ntry {\n    SomeJob::dispatch($payload)->onQueue($queueName);\n} catch (ManagedQueueNotFoundException $e) {\n    // alert ops / fall back to a known-good queue\n    report($e);\n    SomeJob::dispatch($payload)->onQueue(config('queue.connections.cloud.queue'));\n}","preventionTips":["Provision queues via infra-as-code and validate queue names in CI.","Centralize onQueue() values in config to avoid typos.","Catch ManagedQueueNotFoundException and alert ops rather than crashing the dispatcher."],"tags":["laravel-cloud","queue","sqs","managed-queue","configuration"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}