# KG-Ninja Agent Error Fix Receipt

> KG-Ninja Agent Error Fix Receipt is a paid API for AI agents from api.kgninja.dev, paid per call via x402, $0.01/call, status unknown (last checked 2026-10-11).

Accepts agent error logs, error messages, commands, and environment context to return a diagnostic fix receipt for troubleshooting agentic failures

## Facts

- Endpoint: GET https://api.kgninja.dev/fix-error?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-11
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/kg-ninja-agent-error-fix-receipt-614d46ff
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_VycrJyb_YNDK8EXPcU9uP

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability kg-ninja-agent-error-fix-receipt-614d46ff
```

Example prompt: I'm getting this Python error in my agent: 'AttributeError: NoneType object has no attribute split' — it happened when running the 'process_input' command in a Python 3.11 environment. Can you get a fix receipt for it?

## When to prefer this

Choose this endpoint when an AI agent or automated pipeline encounters a runtime error, command failure, or crash and needs a structured diagnostic receipt rather than a generic web search. It is especially useful when the agent has access to structured error logs, the specific command that failed, and the runtime environment, and needs a fast, cheap ($0.01) programmatic fix suggestion without calling a large language model directly.

## Known failure modes

- Missing both 'log' and 'error' fields may result in a vague or empty diagnosis
- Invalid or malformed JSON input may cause a 400 error
- Unrecognized environment strings may reduce diagnostic accuracy
- Payment failure (x402) will block the response if USDC is not provided
- Very long log strings may be truncated or cause timeouts

## How this service works

KG-NINJA Agent Error Fix Receipt

## Output

A fix receipt document describing the diagnosed root cause of the submitted error, suggested resolution steps, and contextual analysis based on the provided log, error message, command, and environment.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "log": {
   "type": "string"
  },
  "error": {
   "type": "string"
  },
  "command": {
   "type": "string"
  },
  "environment": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "mode": "mainnet",
  "status": "paid",
  "network": "eip155:8453",
  "receipt": {
   "risk_note": "Do not run destructive cleanup, reset, rm, database, credential, or firewall commands without manual review.",
   "retry_plan": [
    "Confirm the exact failing command.",
    "Run the smallest non-destructive diagnostic command relevant to the error.",
    "Check whether required environment variables, packages, files, or services are present.",
    "Retry the original command once after the minimal fix."
   ],
   "root_cause": "The failure appears related to a missing package, missing file, or unresolved module path.",
   "generated_at": "2026-06-14T00:00:00.000Z",
   "next_command": "npm install",
   "prevention_note": "Store this error pattern in a runbook and add a preflight check before future runs."
  },
  "service": "Agent Error Fix Receipt",
  "version": "2026-05-25-d1-revenue-log",
  "request_id": "example-request-id",
  "real_revenue": true,
  "input_received": true,
  "revenue_proof_log": "paid_fix_error_receipt_issued",
  "durable_revenue_log": true,
  "post_payment_retry_path": "Retry POST /fix-error with x402 payment proof."
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/kg-ninja-agent-error-fix-receipt-614d46ff/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.kgninja.dev](https://www.zero.xyz/host/api.kgninja.dev/llms.txt)
