<!-- 0Gkit docs — JOBS_HANDLER_THREW
     Source: https://docs.0gkit.com/errors/JOBS_HANDLER_THREW
     LLM-friendly Markdown twin of the page. -->

# JOBS_HANDLER_THREW

**Job handler threw an exception**

## What happened

The user-provided handler for a job threw — the runner catches and surfaces this so the job state machine can move to `failed` cleanly.

## How to fix

Inspect the job's `error` field for the original stack. Fix the handler bug (or add retry logic via `retries:` on the job definition).

## Example

```ts
import { jobs } from "@foundryprotocol/0gkit-jobs";
import { z } from "zod";

const broken = jobs.define({
  name: "broken",
  input: z.object({}),
  output: z.object({}),
  maxAttempts: 3,
  handler: async () => {
    throw new Error("boom");
  },
});
// After maxAttempts exhausted, the runner records JOBS_HANDLER_THREW on the row.
```

## Reference

- Namespace: `JOBS`
- Help URL: `https://0gkit.com/errors/JOBS_HANDLER_THREW`
- See also: [all error codes](/errors)
