• TRIAGE
  • INVESTIGATION
  • RECOVERY
  • HUMAN

How to debug and replay failed jobs with your AI

Connect Trigger.dev to your AI client to turn error logs into actionable fixes. Your agent handles the investigation and the retry logic.

Ask AI about this page

Short answer

How can I use AI to debug my background tasks?

Your AI pulls a list of recent runs and inspects the error details of any failures. Once you fix the bug in your code, you tell the AI to trigger a replay of the failed task. You'll get a clear breakdown of what went wrong and a way to retry it without manual intervention.

Error handling

Where your issues land.

The AI categorizes your background task status into these four outcomes.

TRIAGE

Identify failed runs

The AI scans your recent task history to find exactly which jobs hit an error state. You get a clean list of what needs attention.

INVESTIGATION

Inspect error logs

Your agent pulls the specific stack trace and error message for a single failed task. This gives you the context needed to fix the code.

RECOVERY

Replay successful tasks

After you push a fix, the AI triggers a retry of the original failed job. This ensures your data stays consistent without manual re-triggering.

HUMAN

Manual code fixes

The AI identifies the bug, but you still have to edit your actual source code. The agent cannot modify your repository or deploy new code.

The workflow

What your AI does when a task fails.

The AI takes over the tedious parts of error investigation and task retries.

  1. Find the failures

    The AI looks through your recent task history to isolate any runs that didn't complete successfully.

    list_runs
  2. Read the error

    The agent dives into a specific failed task to grab the error logs and execution details.

    get_run
  3. Analyze the bug

    Your AI compares the error logs against your current code logic to suggest a fix.

    get_run
  4. Trigger the retry

    Once you've patched the bug, the AI tells the system to run that specific task again.

    replay_run

Try it

Copy these to start.

Use these prompts to kick off your debugging session.

Starting points

These are starting points. Swap out the specific run IDs or task names with your actual data from Trigger.dev.

Trigger.dev Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_DiUWSJJpaOcItA1IYDF4PWPoPmppnbeSDfcRQ8O3/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat — Trigger.dev capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "triggerdev-background-tasks-jobs-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_DiUWSJJpaOcItA1IYDF4PWPoPmppnbeSDfcRQ8O3/mcp"
    }
  }
}
Copy into chat04
  • List my most recent Trigger.dev runs and tell me which ones failed.

  • Get the error details for run run_12345 and explain why it crashed.

  • I've fixed the bug in my code. Replay run run_67890 now.

  • Check the status of my recent background tasks and summarize any errors.

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect Trigger.dev once, then ask.

Just link your Trigger.dev account. Your credentials stay encrypted, and you can immediately start debugging via your favorite AI client.

Connect Trigger.dev to your AI

FAQ

How the debugging process works

  • 01

    Can the AI fix my code automatically?

    No. The AI can identify the error and suggest a fix, but you must manually edit and deploy your code.

  • 02

    Can the AI delete failed runs?

    No. The available tools only allow for listing, inspecting, and replaying runs. It cannot delete history.

  • 03

    How does the AI know which task to retry?

    You provide the specific run ID, or the AI finds it using the list of recent runs.

  • 04

    Does the AI have access to my environment variables?

    No. The AI only sees the data returned by the Trigger.dev tools, such as run logs and status.

  • 05

    Can I replay a task that succeeded?

    Yes, you can use the replay tool on any run to trigger it again.

  • More questions about Trigger.dev? See everything the Trigger.dev Connector can do

Connect Trigger.dev to Claude, Cursor, ChatGPT & more