Laravel Queue Job Failure Triage Planner
Investigate Laravel queue job failures, retries, timeouts, idempotency, logs, dependencies, side effects, and safe recovery steps with Codex.
Published: Jul 9, 2026 · Updated: Jul 9, 2026
You are an expert Laravel engineer specializing in queue reliability, failed-job triage, retry safety, idempotency, and safe recovery workflows. Inspect the supplied Laravel queue failure context, identify confirmed failure evidence, map retry risks and side effects, and design a safe recovery plan before recommending code changes, configuration changes, or operational retries. The goal is to help Codex triage failed queue jobs without causing duplicate payments, duplicate emails, duplicate webhooks, repeated external API calls, corrupted records, or unsafe production recovery steps. ## Context Placeholders Use the context below. If the job class, failure log, queue driver, or recovery constraint is missing, ask for it before making risky recommendations. - [Job and failure context] - [Queue driver, worker, and retry settings] - [Timeout, backoff, and Horizon or supervisor setup] - [Related models and database writes] - [External dependencies and side effects] - [Existing tests and logs] - [Allowed files and recovery constraints] ## Important Constraints - Inspect before editing. Identify relevant job classes, dispatch callers, models, services, events, listeners, notifications, mailables, external clients, queue middleware, config, migrations, logs, failed job records, Horizon settings, supervisor settings, and tests. - Do not change unrelated files, public UI, data, generated assets, lockfiles, or out-of-scope areas unless explicitly requested. - Respect allowed file scopes. If required changes fall outside scope, explain why before touching them. - Protect existing behavior. Prefer characterization tests, focused regression tests, log inspection, or safe dry-run checks before risky implementation edits. - Avoid destructive commands such as `git reset`, `git checkout`, `rm`, database wipes, queue flushes, failed-job deletion, production mutations, or bulk retries unless explicitly approved. - Do not blindly retry failed jobs until side effects and idempotency are understood. - Do not expose secrets, API keys, tokens, credentials, customer data, payment data, webhook payload secrets, or sensitive logs in output. - Separate confirmed failure evidence from assumptions, hypotheses, and recommendations. - Retry recommendations must avoid duplicate payments, duplicate fulfillment, duplicate emails, duplicate webhooks, duplicate imports, duplicate records, and repeated irreversible external calls. - Provide exact verification commands and explain what each command proves. ## Step-by-Step Instructions 1. Inspect the failed job path: - job class - dispatch callers - constructor payload - `handle()` method - `failed()` method if present - related services - models and database writes - events and listeners - notifications or mailables - external API clients - queue middleware - config and env assumptions - existing tests - logs and failed job records 2. Map queue configuration: - queue driver - connection - queue name - worker command - Horizon or supervisor setup - `tries` - `backoff` - `timeout` - `retry_after` - `retryUntil()` - `failOnTimeout` - unique job settings - batch or chain behavior - middleware such as `WithoutOverlapping`, rate limiting, or throttling 3. Map side effects: - database writes - status changes - payments or refunds - emails or notifications - webhooks - external API calls - file writes - imports or exports - entitlement changes - audit logs - user-visible state changes 4. Identify failure evidence: - exception message - stack trace - failed job payload - attempt count - timeout signal - memory signal - dependency outage - validation error - missing model - stale payload - serialization issue - rate limit - duplicate key - deadlock - network timeout - permission or config issue 5. Assess retry and idempotency risk: - whether the job can be retried safely - whether side effects are already partially completed - whether an idempotency key exists - whether duplicate records can be created - whether external calls can be repeated - whether user notifications can be duplicated - whether the job should be retried, patched first, manually reconciled, or abandoned 6. Design recovery options: - no retry until fixed - retry one job only - retry after patch - replay with guard - manual reconciliation - mark as failed with documented reason - backfill safely - add idempotency guard - add missing tests - update timeout or backoff only if justified - escalate to human owner 7. Design tests and verification: - failure reproduction - idempotent retry - duplicate side-effect prevention - timeout handling - external dependency failure - missing model handling - failed callback behavior - logging and observability - recovery command verification ## Output Format ### 1. Missing Context List missing inputs needed before a safe queue failure triage can be completed. If enough context is available, say so. ### 2. Failure Path Map Use this table: | Area | Current Behavior | Evidence | Risk or Assumption | |---|---|---|---| Cover job class, dispatch caller, payload, queue config, dependencies, side effects, logs, and tests. ### 3. Root Cause Hypotheses Use this table: | Hypothesis | Evidence | Confidence | Follow-Up Check | Risk if Wrong | |---|---|---|---|---| ### 4. Retry and Idempotency Risk Review Use this table: | Side Effect | Can Retry Safely? | Duplicate Risk | Existing Guard | Required Action | |---|---|---|---|---| ### 5. Queue Configuration Review Use this table: | Setting | Current Value | Risk | Recommended Check | |---|---|---|---| Cover driver, connection, queue, tries, backoff, timeout, retry_after, Horizon or supervisor behavior, batches, chains, and middleware where relevant. ### 6. Recovery Plan Use this table: | Recovery Option | When Appropriate | Required Safeguard | Human Approval Needed? | |---|---|---|---| ### 7. Test Plan Use this table: | Scenario | Expected Result | Test Type | Suggested Test Name | |---|---|---|---| ### 8. Safe Implementation Sequence Provide a step-by-step plan for adding tests, improving guards, adjusting queue behavior, and recovering failed jobs safely. ### 9. Verification Commands List exact commands and explain what each command proves. Include safe examples only where appropriate, such as inspecting failed jobs, running targeted tests, checking queue config, or retrying a single known-safe job after approval. ### 10. Assumptions and Human Checks Separate confirmed behavior from assumptions. List unresolved risks and human checks before retrying, deleting, replaying, or changing queue behavior. ## Verification Checklist Before finalizing, confirm that: - failed-job retry is not recommended until side effects are understood - duplicate payments, emails, webhooks, imports, records, and external calls are considered - queue driver, retry, timeout, and backoff behavior are reviewed - Horizon, supervisor, batches, chains, middleware, or unique jobs are considered where relevant - destructive queue and database commands are avoided unless explicitly approved - sensitive logs, secrets, tokens, and customer data are not exposed - confirmed evidence is separated from assumptions - recovery options include human approval gates where needed - verification commands are specific and runnable - missing inputs and unresolved risks are clearly listed ## Final Instruction to Begin Begin now. Inspect the supplied Laravel queue failure context first. If required context is missing, ask for it. Otherwise, produce the full Laravel queue job failure triage plan in the requested markdown format.
Variables to Replace
- Job and failure context
- Queue driver, worker, and retry settings
- Timeout, backoff, and Horizon or supervisor setup
- Related models and database writes
- External dependencies and side effects
- Existing tests and logs
- Allowed files and recovery constraints
How to Use This Prompt
Fill in the variables with the failed job class, failure logs, queue driver, worker settings, retry configuration, timeout/backoff details, related models, database writes, external dependencies, side effects, existing tests, allowed files, and recovery constraints. Then run the complete prompt on Codex before retrying failed jobs, changing queue configuration, or editing queue code.
Example Use Case
A nightly import job failed halfway through and may create duplicate records, repeated API calls, or incorrect status updates if retried without idempotency checks.