Skip to content

Stackyard API error reference

Every API error has a readable error, a kind to branch on, and sometimes a detail.

{ "error": "Could not reach the service.", "kind": "network", "detail": { "code": "ECONNREFUSED" } }

Never match words in error. Use kind.

The error text is written from the kind, never copied from the underlying error, so no internal host or path reaches the browser. The original is logged.

KindMeaning
networkThe target could not be reached.
timeoutThe target was too slow.
blockedStackyard refused the request, by its guard or rate limit.
authThe Stackyard session or password. Never an upstream key.
upstreamThe target answered with an error. detail.status holds it.
invalidA malformed request, or a missing item.
internalAnything else.

An upstream 401 or 403 is upstream, not auth. Treat an unknown kind as internal.

Only these keys, only server-derived values, and omitted when empty.

KindKey
network, timeoutcode, a Node error code
upstreamstatus, the HTTP status
invalidcode, such as ERR_INVALID_URL
blockedreason, private-address

A new kind goes in KIND in both api/src/api-error.js and ui/js/admin-error.js. A test fails until they match.