Skip to content

Error Handling

All NeuralRepo API errors return a JSON object with an error field describing what went wrong.

{
"error": "A human-readable error message"
}

The error field is always a string. The HTTP status code indicates the category of error.

The request body or query parameters failed validation.

{
"error": "Title must be between 1 and 200 characters"
}

Common causes:

  • Missing required fields (e.g., title on idea creation)
  • Field exceeds length limit (body > 50,000 chars, tags > 20 items)
  • Invalid format (e.g., color not matching #rrggbb, invalid URL)
  • Invalid query parameter values

Authentication is missing or invalid.

{
"error": "Invalid API key"
}

Common causes:

  • No Authorization or X-API-Key header provided
  • Expired session token
  • Revoked or malformed API key

The request is authenticated but not allowed.

{
"error": "Plan limit exceeded: upgrade to create more ideas"
}

Common causes:

  • Plan limits reached (e.g., free plan idea cap)
  • No BYOK key configured when calling /ideas/:id/develop
  • Insufficient scope on the API key

The requested resource does not exist.

{
"error": "Idea not found"
}

Common causes:

  • Invalid or non-existent ID in the URL path
  • Resource belongs to another user
  • Archived resource (in some contexts)

The request conflicts with the current state of a resource.

{
"error": "Relation would create a cycle"
}

Common causes:

  • Creating a relation that would form a cycle in the graph (see ?force=true in Relations)
  • Merging an idea that is already archived
  • Creating a tag with a name that already exists
  • Duplicate detection conflict during idea creation

You have exceeded the rate limit. See Rate Limits for details.

{
"error": "Rate limit exceeded"
}

Wait for the time indicated by the Retry-After header before retrying.

An unexpected error occurred on the server.

{
"error": "Internal server error"
}

If this persists, contact support. These errors are logged and monitored automatically.

const res = await fetch("https://neuralrepo.com/api/v1/ideas", {
method: "POST",
headers: {
"X-API-Key": "nrp_YOUR_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({ title: "" }),
});
if (!res.ok) {
const { error } = await res.json();
switch (res.status) {
case 400:
console.error("Validation error:", error);
break;
case 401:
console.error("Auth error — check your API key");
break;
case 429:
const retryAfter = res.headers.get("Retry-After");
console.error(`Rate limited. Retry after ${retryAfter}s`);
break;
default:
console.error(`Error ${res.status}:`, error);
}
}
StatusNameRetryableDescription
400Bad RequestNoFix the request and resend
401UnauthorizedNoCheck authentication credentials
403ForbiddenNoCheck plan limits or permissions
404Not FoundNoVerify the resource ID
409ConflictNoResolve the conflict (e.g., use ?force=true)
429Too Many RequestsYesWait and retry with backoff
500Internal Server ErrorYesRetry with exponential backoff