Skip to content

Error Codes

All API errors return a consistent JSON structure. This page documents every error type, its HTTP status code, and the response body format.

Every error response follows this structure:

{
"error": "ErrorCode",
"message": "Human-readable description",
"path": "affected.field.path",
"suggestion": "How to fix this",
"details": {}
}
FieldTypeAlways presentDescription
errorstringYesMachine-readable error code
messagestringYesHuman-readable description of what went wrong
pathstringNoDot-delimited path to the affected field (e.g. field_values.priority)
suggestionstringNoActionable fix for the error
detailsobjectNoAdditional structured information (varies by error type)

ErrorHTTP StatusDescription
ThogitNotFound404Thogit ID does not exist
TagNotFound404Tag ID does not exist
TagAlreadyApplied409Tag is already applied to this thogit
DuplicateTagName409Another tag already has this name
TagInUse400Cannot delete tag that is applied to thogits
MissingField400Required field not provided
ValidationErrors400Field values don’t match schema
FilterError400Invalid filter syntax or unknown tag/field
SchemaError400Invalid schema definition
InvalidReference400Reference points to non-existent thogit
DatabaseError500Internal database error

Returned when a thogit ID is referenced but does not exist in the database.

{
"error": "ThogitNotFound",
"message": "Thogit not found: 01JQXK6V9XCSV5K9Z1MQSK5RBT"
}

Returned when a tag ID is referenced but does not exist or has been soft-deleted.

{
"error": "TagNotFound",
"message": "Tag not found: 01JR2M8K3XNWV7P4Q6YT0HABCD"
}

Returned when attempting to apply a tag that is already on the thogit.

{
"error": "TagAlreadyApplied",
"message": "Tag 'Project Tracker' is already applied to this thogit",
"suggestion": "Remove the tag first if you want to re-apply it with different values"
}

Returned when creating or renaming a tag would conflict with an existing tag name.

{
"error": "DuplicateTagName",
"message": "A tag named 'Project Tracker' already exists",
"suggestion": "Choose a different name"
}

Returned when attempting to delete a tag that is still applied to one or more thogits.

{
"error": "TagInUse",
"message": "Cannot delete tag 'Project Tracker': applied to 12 thogits",
"suggestion": "Remove the tag from all thogits before deleting"
}

Returned when a required request field is not provided.

{
"error": "MissingField",
"message": "Field 'name' is required",
"path": "name"
}

Returned when field values do not match the tag schema. The details object contains per-field validation errors.

{
"error": "ValidationErrors",
"message": "2 field validation errors",
"details": {
"errors": [
{
"path": "priority",
"expected_type": "Number",
"actual_type": "String",
"suggestion": "Use a numeric value like 42"
},
{
"path": "due_date",
"expected_type": "Date",
"actual_type": "String",
"suggestion": "Use YYYY-MM-DD format like \"2024-01-15\""
}
]
}
}

Each entry in the errors array has:

FieldTypeDescription
pathstringField name that failed validation
expected_typestringThe schema type the field expects
actual_typestringThe JSON type of the value that was provided
suggestionstringHow to fix the value

Returned when a filter is syntactically invalid or references unknown tags/fields.

{
"error": "FilterError",
"message": "Unknown tag 'Projct' in filter 'Projct.status'",
"suggestion": "Did you mean 'Project'?"
}

Returned when a tag schema definition is invalid.

{
"error": "SchemaError",
"message": "Invalid field type 'Text' in schema",
"path": "schema.title",
"suggestion": "Valid types are: String, Number, Boolean, Date, Reference, Select, MultiSelect"
}

Returned when a Reference field value points to a thogit that does not exist.

{
"error": "InvalidReference",
"message": "Reference field 'parent' points to non-existent thogit: 01JQXK6V9XCSV5K9Z1MQSK5RBT",
"path": "field_values.parent"
}

Returned on unexpected internal failures. The message is generic to avoid leaking implementation details.

{
"error": "DatabaseError",
"message": "Internal server error"
}

CodeMeaningWhen it occurs
200SuccessSuccessful GET, PUT, PATCH, DELETE
302RedirectOAuth authentication flows
400Bad RequestValidation errors, schema errors, filter errors, tag in use, invalid reference
401UnauthorizedNo session cookie, or 2FA pending
404Not FoundThogit or tag ID does not exist
409ConflictDuplicate tag name, tag already applied
500Internal Server ErrorDatabase failures, unexpected panics

import { client } from 'thogits-client';
try {
const thogit = await client.getThogit({ id });
} catch (err) {
if (err.status === 404) {
console.log('Thogit not found');
} else if (err.status === 400 && err.body?.error === 'ValidationErrors') {
for (const detail of err.body.details.errors) {
console.log(`${detail.path}: expected ${detail.expected_type}, got ${detail.actual_type}`);
console.log(` Fix: ${detail.suggestion}`);
}
}
}