Download README.md from SalutefaceAAC/api-error-resolution-pairs: direct link, hf CLI and curl.
- Browser
- Download file 9.5 kB
-
https://huggingface.co/datasets/SalutefaceAAC/api-error-resolution-pairs/resolve/main/README.md
- Command line
-
hf download hf://datasets/SalutefaceAAC/api-error-resolution-pairs/README.md
-
curl -L -o README.md https://huggingface.co/datasets/SalutefaceAAC/api-error-resolution-pairs/resolve/main/README.md
language:
- en
license: apache-2.0
task_categories:
- text-generation
tags:
- api
- debugging
- error-resolution
- code
- synthetic
- python
- javascript
- typescript
- go
- java
- rest
pretty_name: API Error Resolution Pairs
size_categories:
- n<1K
dataset_info:
features:
- name: id
dtype: int64
- name: language
dtype: string
- name: library
dtype: string
- name: error_type
dtype: string
- name: error_message
dtype: string
- name: broken_code
dtype: string
- name: explanation
dtype: string
- name: fixed_code
dtype: string
- name: key_insight
dtype: string
- name: tags
dtype: string
splits:
- name: train
num_examples: 132
- name: validation
num_examples: 16
- name: test
num_examples: 16
API Error Resolution Pairs
A synthetic dataset of real-world API error scenarios paired with explanations and fixes. Each example captures a broken code snippet, the error it produces, a plain-English explanation of the root cause, a corrected implementation, and a distilled key insight.
Dataset Summary
| Split | Examples |
|---|---|
| train | 132 |
| validation | 16 |
| test | 16 |
| Total | 164 |
Quick Start
Load the dataset
from datasets import load_dataset
ds = load_dataset("SalutefaceAAC/api-error-resolution-pairs")
print(ds)
# DatasetDict({
# train: Dataset({features: [...], num_rows: 132}),
# validation: Dataset({features: [...], num_rows: 16}),
# test: Dataset({features: [...], num_rows: 16})
# })
# Inspect a record
example = ds["train"][0]
print(example["error_type"]) # e.g. "timeout_missing"
print(example["broken_code"]) # code that triggers the error
print(example["fixed_code"]) # corrected implementation
print(example["key_insight"]) # one-sentence principle
Filter by language or error type
# All Python examples
py_examples = ds["train"].filter(lambda x: x["language"] == "python")
# Rate-limiting errors only
rate_limit = ds["train"].filter(lambda x: x["error_type"] == "rate_limit")
# Multi-filter: TypeScript + auth errors
ts_auth = ds["train"].filter(
lambda x: x["language"] == "typescript" and "auth" in x["error_type"]
)
RAG retrieval (semantic search over error patterns)
from sentence_transformers import SentenceTransformer
import numpy as np
model = SentenceTransformer("all-MiniLM-L6-v2")
train = ds["train"]
# Embed error messages as the retrieval key
embeddings = model.encode(train["error_message"], show_progress_bar=True)
def find_similar(query: str, top_k: int = 3):
q_emb = model.encode([query])
scores = np.dot(embeddings, q_emb.T).squeeze()
top_idx = np.argsort(scores)[::-1][:top_k]
for i in top_idx:
print(f"[{scores[i]:.3f}] {train[int(i)]['error_type']} — {train[int(i)]['key_insight']}")
find_similar("Connection refused when calling external API")
Fine-tuning prompt template
def format_for_finetuning(example):
"""Format a record as an instruction-following prompt."""
prompt = (
f"Language: {example['language']}\n"
f"Library: {example['library']}\n"
f"Error: {example['error_message']}\n\n"
f"Broken code:\n```\n{example['broken_code']}\n```\n\n"
"Explain the root cause and provide the corrected implementation."
)
completion = (
f"Root cause: {example['explanation']}\n\n"
f"Fixed code:\n```\n{example['fixed_code']}\n```\n\n"
f"Key insight: {example['key_insight']}"
)
return {"prompt": prompt, "completion": completion}
formatted = ds["train"].map(format_for_finetuning)
Sample Records
Example 1 — Python / requests: Large file download (MemoryError)
| Field | Value |
|---|---|
language |
python |
library |
requests |
error_type |
stream_large_response |
error_message |
MemoryError downloading large file |
Broken code:
resp = requests.get("https://example.com/large-file.zip")
with open("large-file.zip", "wb") as f:
f.write(resp.content)
Fixed code:
resp = requests.get("https://example.com/large-file.zip", stream=True)
with open("large-file.zip", "wb") as f:
for chunk in resp.iter_content(chunk_size=8192):
f.write(chunk)
Key insight: Use stream=True and iter_content() to download large files without loading them into memory.
Example 2 — JavaScript / axios: Unhandled cancellation
| Field | Value |
|---|---|
language |
javascript |
library |
axios |
error_type |
cancel_request |
error_message |
CanceledError unhandled when navigating away |
Broken code:
const source = axios.CancelToken.source();
axios.get("/slow-api", { cancelToken: source.token });
source.cancel();
Fixed code:
const controller = new AbortController();
try {
const resp = await axios.get("/slow-api", { signal: controller.signal });
process(resp.data);
} catch (err) {
if (!axios.isCancel(err)) throw err;
}
// to cancel: controller.abort();
Key insight: Use AbortController with axios (v1+) and filter cancellations with axios.isCancel(err).
Example 3 — REST: Content negotiation failure
| Field | Value |
|---|---|
language |
rest |
library |
generic |
error_type |
content_negotiation |
error_message |
406 Not Acceptable |
Broken request:
GET /api/data
Accept: text/html
Fixed request:
GET /api/data
Accept: application/json
Key insight: Match the Accept header to the media types the server advertises.
Schema
| Field | Type | Description |
|---|---|---|
id |
int | Unique record identifier |
language |
string | Programming language (python, javascript, typescript, go, java, rest) |
library |
string | Library or framework (requests, httpx, boto3, openai, anthropic, fetch, axios, okhttp, net/http, …) |
error_type |
string | Short error category slug |
error_message |
string | The actual error message or symptom |
broken_code |
string | Snippet that triggers the error |
explanation |
string | Root cause explanation |
fixed_code |
string | Corrected implementation |
key_insight |
string | One-sentence principle to prevent this class of error |
tags |
string | Comma-separated tag list |
Coverage
Languages & Libraries
| Language | Libraries |
|---|---|
| Python | requests, httpx, boto3, openai, anthropic, aiohttp, grpc, gql, stripe, google-auth, redis |
| JavaScript | fetch, axios |
| TypeScript | openai, react-query |
| Go | net/http |
| Java | okhttp |
| REST | Generic HTTP patterns |
Error Categories
- Auth: missing/malformed credentials, 401 flows
- Timeout: missing timeouts, context deadlines
- JSON body: wrong encoding, missing Content-Type
- Error handling: unchecked 4xx/5xx, silent failures
- Rate limiting: 429, Retry-After, backoff
- Pagination: offset vs cursor, last-page edge cases
- Resource leaks: unclosed bodies, sessions, connections
- SSL/TLS: certificate verification, insecure channels
- Performance: connection pools, pipelines, parallel requests
- Streaming: async iteration, chunk handling
- Function/tool calling: history management, tool result format
- Structured output: JSON mode, Zod schemas
- Idempotency: duplicate charges, retry safety
- Versioning: breaking changes, additive vs destructive
Generation Methodology
Records were hand-authored one at a time, each capturing a distinct error pattern from real developer experience. A parametric augmentation layer generates variants across different API endpoints, token formats, and timeout values to increase dataset breadth without noise. All records passed MD5-based deduplication (keyed on broken_code + fixed_code).
No model was used to generate records. All broken_code / fixed_code / explanation / key_insight values were written manually.
Intended Uses
- Fine-tuning code LLMs on error diagnosis and remediation
- Retrieval-augmented code assistance (RAG over error patterns)
- Benchmark evaluation for debugging models
- Developer education tooling
Limitations
- Augmentation depth: parametric augmentation varies endpoints and timeout values only — augmented records share structure with their base and increase breadth but not conceptual depth.
- Language coverage: Java examples focus on Android context (OkHttp); server-side Java (Spring, Quarkus) patterns are underrepresented. Go examples cover
net/httponly. - Scenario complexity: each record is a single-error / single-fix scenario. Multi-step debugging chains and cascading failures are out of scope.
- Domain scope: covers mainstream REST and gRPC clients; WebSocket, GraphQL subscriptions, and binary protocols are not included.
- No runtime validation: code snippets are validated by human review, not executed; edge-case compilation issues may exist.
License
Apache 2.0
Citation
@dataset{saluteface_api_error_resolution_2026,
title = {API Error Resolution Pairs},
author = {SalutefaceAAC},
year = {2026},
url = {https://huggingface.co/datasets/SalutefaceAAC/api-error-resolution-pairs}
}