/kavo-skills:error-handlingfrom Kavo Developer Skills
Reference for Kavo's exception hierarchy, KAVO_* error-code catalog, and RFC 9457 problem-details wire shape. Use when handling/mapping Kavo errors or deciding which exception to throw.
Ships in Kavo Developer Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
One exception hierarchy (core/src/errors/), one stable code catalog, one
wire shape (RFC 9457 problem details, ADR-0009). Full detail:
docs/internals/architecture/06-error-handling.md.
KavoException (abstract; implements the KavoExceptionShape contract)
├─ QueryValidationException carries issues[] → errors[] extension
├─ NotFoundException
├─ ConflictException
├─ AlreadyDeletedException soft-deleting an already-deleted row → 409
├─ NotDeletedException restoring/purging a live row → 409
├─ OperationDisabledException
├─ OperationNotRegisteredException registry miss, never "disabled"
├─ BulkOperationException carries items[] (reserved — bulk not built)
├─ PersistenceException
├─ TransactionException carries retryable: boolean
├─ ConfigurationException bootstrap-only, never a wire response
└─ PaginationNotAdvancingException cursor page produced its own token → 500
(ADR-0021 §5); data-/adapter-dependent
Every leaf binds exactly one catalog code; status, title, and message
template all come from the catalog, so a thrown exception can never
disagree with its own documented response. @kavo/nest's
KavoExceptionFilter (@Catch(KavoException)) is the only place Kavo
touches HTTP — Kavo exceptions never extend Nest's, and core never depends
on framework exception types.
ERROR_CATALOG, core/src/errors/error-catalog.ts)Codes are API surface — renaming one is a breaking (semver) change.
| Code | HTTP | Fires when | Payload extensions |
|---|---|---|---|
KAVO_QUERY_INVALID | 400 | Any query grammar/allowlist/limit violation (aggregate) | errors[] of the sub-codes below |
KAVO_QUERY_INVALID_FIELD | 400 | Field not on the filter/sort/select allowlist | issue-level |
KAVO_QUERY_INVALID_OPERATOR | 400 | Unknown or misspelled wire operator | issue-level |
KAVO_QUERY_INVALID_VALUE | 400 | Coercion failure, malformed bounds, bad pagination value | issue-level |
KAVO_QUERY_LIMIT_EXCEEDED | 400 | limits.filterDepth / limits.inValues exceeded | issue-level |
KAVO_QUERY_UNSUPPORTED_PARAM | 400 | withDeleted/onlyDeleted on a hard-delete entity, or from a client without delete.allowDeletedReads; include with no include resolver wired | issue-level |
KAVO_NOT_FOUND | 404 | Target row missing on findOne/updateOne/patchOne/deleteOne | — |
KAVO_CONFLICT | 409 | Unique/FK violation mapped by the adapter | — |
KAVO_ALREADY_DELETED | 409 | Soft-deleting an already-deleted row | — |
KAVO_NOT_DELETED | 409 | Restoring or purging a row that is not deleted | — |
KAVO_OPERATION_DISABLED | 405 | Programmatic/HTTP call to a disabled registry entry | — |
KAVO_OPERATION_NOT_REGISTERED | 405 | Programmatic call naming an operation the registry has no entry for at all | — |
KAVO_BULK_FAILED | 422 | Atomic bulk failure (reserved — bulk is not built) | items[] per-index issues |
KAVO_PERSISTENCE_FAILED | 500 | Unrecognized adapter/driver error | cause kept internally |
KAVO_TRANSACTION_FAILED | 500 | Deadlock/serialization failure | retryable flag |
KAVO_CONFIG_INVALID | 500 | Bootstrap config error — fails startup, never a response | — |
KAVO_PAGINATION_NOT_ADVANCING | 500 | Cursor page produced the token it was given; following meta.nextCursor would loop forever (ADR-0021 §5) | — |
Every exception carries ErrorContext (entityName, operation,
correlationId); the engine's DefaultErrorHandler fills in whatever the
throw site didn't set. detail strings render from messageKey (= the
code) + messageParams via the catalog's {param} templates, so a
consumer can localize by re-rendering the same key/params — core ships only
the English defaults.
Adapter errors are translated by the adapter's own table (@kavo/typeorm's
mapDriverError) inside the adapter; anything unrecognized that
reaches the engine becomes PersistenceException with the original as
cause — never swallowed. Whether cause details leak into the wire
response is governed by errors.exposeInternals (default false — see the
global-config skill).
toProblemDetails(exception, { exposeInternals }){
"type": "https://kavo.dev/errors/kavo-not-found",
"title": "Not Found",
"status": 404,
"detail": "User with id '42' was not found.",
"instance": "urn:kavo:request:<correlationId>",
"code": "KAVO_NOT_FOUND"
}
type — https://kavo.dev/errors/<kebab-code>.title/status — from the catalog.errors[] — present on query-validation failures, one entry per
independent issue (filter/sort/fields/pagination violations all collect
into one exception/response, never a per-field round trip).items[] — bulk (reserved, not built).@kavo/nest's filter serves this with
Content-Type: application/problem+json. A different wire shape means
swapping the serializer, never the exception hierarchy.@Override)Throw the existing KavoException subclass that matches the failure
(NotFoundException, ConflictException, etc.) rather than a bare Error
or a Nest HttpException — that's what keeps a custom handler's failures
indistinguishable from a generated route's at the wire level. Adding an
entirely new failure mode (not covered by an existing leaf) is the
add-exception skill's job, not something to improvise inline.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
kavo, error-handling, exception-hierarchy, error-codes, problem-details
npx claudepluginhub kavo-labs/kavo --plugin kavo-skills15 skills in this plugin
/composite-primary-keysReference for composite primary key support in @kavo/typeorm — the compositeIdFields metadata field, the ~-delimited route-id encoding, the creatable/updatable split, and every place composite keys don't yet work (other ORM adapters, many-to-many array-mutation, @kavo/graphql). Use when an entity has more than one @PrimaryColumn, or when a route id, association, or array-mutation write on such an entity behaves unexpectedly./dto-slotsReference for Kavo's six optional schema slots (create/update/patch/query/item/list) — entity-derived defaults, the schemaShapeKeys narrowing rule, and serialization order. Use when configuring a DTO class or validator on @Kavo's schema option, or answering "why isn't my field showing/hiding" or "what shape does this response have" questions./global-configReference for Kavo's global configuration — the KavoSettings precedence chain, built-in defaults table, KavoModule.forRoot/forRootAsync options, and the operations.<id> global-default caveat (ADR-0015). Use when wiring createKavo/KavoModule.forRoot, setting app-wide defaults, or answering "what can I configure globally" questions./graphql-bindingReference for @kavo/graphql and its Nest binding — building a schema over an existing createCrud service, the raw-AST filter/sort args, multi-entity merging, the process-wide type registry, and the zero-code KavoModule graphql option. Use when exposing an entity over GraphQL, or answering "how do I add GraphQL to this entity" questions./kavo-decoratorReference for what @Kavo(Entity, config?) generates and how to configure/override it — routes table, EntityConfig shape (schema/allowed/operations), manual-method-wins, @Override, and fully custom routes. Use when writing or reviewing a @Kavo-decorated controller, or answering "how do I configure/override this route" questions./mcp-bindingReference for @kavo/mcp and its Nest binding — the standard per-entity toolset, findMany's raw-AST filter/sort args, flat update/patch args, isError result mapping, the zero-config KavoModule mcp option, and the fact that the default MCP route carries no auth guard. Use when exposing entities to an MCP client, or answering "how do I add MCP tools to this entity" questions.Other plugins' skills for the same job