# Troubleshooting

Start with the symptom. Most answers come from two calls: `GET /api/v1/queue` (why a job waits) and `GET /api/v1/repos` (`last_error` and `dispatch` for each repository).

## A job stays "Queued" on GitHub

### Kajiya lists it as waiting

`GET /api/v1/queue` (or the dashboard's live queue) shows the job with a `reason`. Each reason and its fix are in [wait reasons](/docs/queue-and-limits#wait-reasons). The ones that do not clear by themselves:

- `paused`: the repository is paused in Kajiya. Resume it.
- `no_credit`: buy a compute pack.
- `limit` on a `kajiya-8` job of a new account: new accounts run at most 4 vCPUs at once, so `kajiya-8` waits until the account is [established](/docs/queue-and-limits#account-limits). Use `kajiya-4` until then.
- `repo_limit` that never clears: the repository's `max_vcpu` cap is smaller than the job. Raise the cap.
- `no_host` on a tier-pinned label (`kajiya-4-s`): no machine of that tier has room. Remove the pin.

### Kajiya does not list it at all

Kajiya has not seen the job, or it does not look like a Kajiya job:

1. **The label.** `runs-on` must be exactly `kajiya-2`, `kajiya-4` or `kajiya-8`, optionally with a tier (`kajiya-4-s`). Other sizes such as `kajiya-16` are ignored. If `runs-on` is a list, GitHub needs a runner with every label in it, so use the Kajiya label alone.
2. **The repository is connected.** It must be listed in `GET /api/v1/repos` (or **Repositories** in the dashboard), not paused, and connected to the account you are looking at.
3. **`last_error` on the repository.** An expired or revoked token shows up here, for example `GitHub 401: Bad credentials`. Connect the repository again with a new token ([replace an expired token](/docs/connect-github#replace-an-expired-token)).
4. **Polling delay.** A repository in `polling` mode is checked every 60 seconds when it has been idle. Call `POST /api/v1/repos/{id}/sync` to check now, and give the token *Webhooks: Read and write* (or use the GitHub App) so jobs are seen within seconds.

### Kajiya dispatched it, but it never ran

If the machine that took the job goes offline before the VM starts, Kajiya marks the job `failed` (not billed) after about two minutes. It does not dispatch the same GitHub job again, so the job stays queued on GitHub: re-run it. A re-run creates a new job, which Kajiya dispatches normally.

## The webhook is not active

`dispatch` in `GET /api/v1/repos` tells you how Kajiya watches each repository.

- **`polling` with "Token cannot manage webhooks"**: the token lacks *Webhooks: Read and write*. Add the permission (or create a new token) and connect the repository again.
- **`polling` with "GitHub rate limit while installing the webhook"**: connect the repository again later.
- **`webhook_pending` that stays pending**: GitHub has not delivered any event to Kajiya yet. On GitHub, open the repository's **Settings → Webhooks**, select the Kajiya webhook and check **Recent Deliveries** for errors; **Redeliver** the ping.

Polling still dispatches jobs, only more slowly.

## Token and connection errors

| Message | Cause and fix |
|---|---|
| `Token has no admin permission on this repository (needs Administration: read/write).` | Give the fine-grained token *Administration: Read and write*, and make sure your GitHub user administers the repository. |
| `GitHub 401: Bad credentials` | The token expired or was revoked. Connect the repositories again with a new one. |
| `GitHub 404: Not Found` | The token cannot see the repository: it is not among the token's selected repositories, the resource owner is wrong, or the organization has not approved the token. |
| `GitHub 403: Resource not accessible by personal access token` | A permission is missing for that call, typically *Actions: Read and write* when cancelling. |
| `This repository is connected to another Kajiya account.` | Each repository belongs to one Kajiya account. Disconnect it there first. |
| `Repository must look like owner/name.` | Send `acme/api`, not a URL. |
| Skipped: `Token has no admin permission here.` / `Archived.` | Bulk connect skips repositories the token does not administer and archived ones. |

## A cancelled job was billed

- **The job was already running.** A running VM is billed for the minutes it ran, as on GitHub-hosted runners.
- **The VM was booting when the job was cancelled.** Its runner then has no job to take, so the VM stops itself after 4 minutes ([idle stop](/docs/runners#time-limits)) and is billed for those minutes. If the repository is connected through the GitHub App or a repository webhook, Kajiya releases jobs that no machine had taken yet and they are not billed; with polling, Kajiya does not learn about a cancel on GitHub in time. Cancel through Kajiya (`POST /api/v1/jobs/{id}/cancel`) to release such jobs, or use the App.

## A job was stopped after 58 minutes

Jobs are stopped after 58 minutes of runtime. Split long work into several jobs ([matrix builds and sharding](/docs/guides/matrix-and-sharding)).

## The bill is higher than the job's runtime

- Every job is billed in whole minutes, at least one, and the time includes the VM's boot and shutdown.
- Runtime is measured per VM: a matrix of 20 one-minute jobs is 20 billed minutes.
- VMs that stopped after the idle timeout are billed (see above).

Every job's `runtime_seconds`, `billed_seconds` and `cost_usd` are in `GET /api/v1/jobs` and the **Jobs** tab.

## Commands or tools are missing

| Error | Fix |
|---|---|
| `node: command not found` (and other languages) | Add `actions/setup-node` (or the matching `setup-*` action). |
| `docker: 'compose' is not a docker command` | `sudo apt-get update && sudo apt-get install -y docker-compose-v2` |
| `gh: command not found` | `sudo apt-get update && sudo apt-get install -y gh` |
| `error: externally-managed-environment` from `pip install` | Use `actions/setup-python`, or `python3 -m venv .venv` and install into it. |
| `ERROR: docker buildx` not available | Add `docker/setup-buildx-action`. |

[What is installed](/docs/runners#preinstalled-software) lists the base image.

## Network calls time out

- Outbound TCP to ports 3333, 4444, 5555, 7777, 8888, 9999, 14433, 14444, 45700 is blocked everywhere. Use another port for that service.
- Private ranges (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`, `100.64.0.0/10`, `169.254.0.0/16`) are unreachable, so a job cannot reach services on your private network or a Tailscale network.
- Docker Hub may rate-limit anonymous pulls from shared addresses; log in first ([Docker guide](/docs/guides/docker-and-caching#docker-hub-pull-limits)).

## API errors

| Status | Fix |
|---|---|
| `401 Invalid token.` | The key is wrong, revoked or expired. `This API key was revoked.` and `This API key has expired.` say which. |
| `403 ... this action needs "write"` | Create a key with a larger scope. |
| `429 Rate limit` | Wait `Retry-After` seconds. The 1,200-per-minute limit is shared by all keys of the account. |
| `502` | GitHub refused or could not be reached; the message includes GitHub's answer. |

## Webhook deliveries fail

Check `GET /api/v1/webhook/deliveries` for `last_status` and `last_error`:

- **`HTTP 3xx`**: Kajiya does not follow redirects. Use the final URL.
- **Timeouts**: answer within 10 seconds and do slow work afterwards.
- **`webhook host resolves to a private address`**: the URL must resolve to a public address.
- **Your endpoint rejects the signature**: verify against the raw body, use the current secret (rotating replaces it at once), and check that your server's clock is correct. See [verifying signatures](/docs/webhooks#verifying-signatures).

## Buying a pack fails

- `Connect a GitHub repository before buying a compute pack.`: connect one first.
- `Purchase limit: ...`: new accounts can buy $50 of packs per 24 hours, established ones $500. A checkout you started but did not finish counts until you start a new one, which cancels it; if it still counts, close the old checkout window and try again.

## Signing in fails

- **Account too new**: GitHub accounts must be at least 24 hours old.
- **Verified email needed**: verify a primary email address in your GitHub settings.
- **This email is already linked to a different GitHub account**: sign in with the GitHub account you used before.

## Still stuck

Email hello@vetter-ai.com with the repository, the GitHub run URL and the time. We reply within 2 business days.
