Sample
@fastify/error 4.2.0: FastifyError
Verified sample for npm @fastify/error 4.2.0: FastifyError. The contract ran on node 22 · linux debian/x64 · docker and passed.
sha256:19bb209ba17303f3565f9f2311c7d7781414412f6b1c7bd914d86e0adf5813c7
This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured.
How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people.
MIT-0
Execution evidence
The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.
- Evidence basis
- Signed contract pass
- Verification receipts
- 1
- Signing keys that built it
- 1
Declared environment
linux 24 · ubuntu · glibc 2.39 x64 npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2… |
2026-10-20 |
Case
HOW- Goal
- verify @fastify/error.FastifyError in pkg:npm/%40fastify/error@4.2.0
- Packages
- Symbols
-
- @fastify/error.FastifyError
- Created
- 2026-10-20T14:05:50Z
Contract
- new FastifyError() and FastifyError() return an Error instance with name 'FastifyError', code 'FST_ERR', message 'Fastify Error', statusCode 500, and toString() 'FastifyError [FST_ERR]: Fastify Error'
- Errors created by constructors returned from createError(code, message, statusCode) satisfy `err instanceof FastifyError` via Symbol.hasInstance while formatting printf-style args and extracting a trailing `{ cause }` option
- Plain Error instances do not satisfy `instanceof FastifyError`, and generic FastifyError instances do not satisfy `instanceof` a specific custom error constructor
Files
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- test/contract.mjs
Source
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify @fastify/error.FastifyError in pkg:npm/%40fastify/error@4.2.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40fastify/error@4.2.0
Demonstrate these symbols/APIs:
- @fastify/error.FastifyError
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:45e1f3f0b2495c4b5fa75ab397aaec875b5a210440ecb11d3bec475494325efd","contract":["new FastifyError() and FastifyError() return an Error instance with name 'FastifyError', code 'FST_ERR', message 'Fastify Error', statusCode 500, and toString() 'FastifyError [FST_ERR]: Fastify Error'","Errors created by constructors returned from createError(code, message, statusCode) satisfy `err instanceof FastifyError` via Symbol.hasInstance while formatting printf-style args and extracting a trailing `{ cause }` option","Plain Error instances do not satisfy `instanceof FastifyError`, and generic FastifyError instances do not satisfy `instanceof` a specific custom error constructor"],"goal":"verify @fastify/error.FastifyError in pkg:npm/%40fastify/error@4.2.0","kind":"HOW","packages":["pkg:npm/%40fastify/error@4.2.0"],"schemaVersion":1,"symbols":["@fastify/error.FastifyError"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40fastify/error@4.2.0"],"schemaVersion":1,"subject":"pkg:npm/%40fastify/error@4.2.0","symbols":["@fastify/error.FastifyError"],"verifierAdapter":"node-typescript@1"}
{
"name": "fastify-error-sample",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "fastify-error-sample",
"version": "1.0.0",
"dependencies": {
"@fastify/error": "4.2.0"
}
},
"node_modules/@fastify/error": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/@fastify/error/-/error-4.2.0.tgz",
"integrity": "sha512-RSo3sVDXfHskiBZKBPRgnQTtIqpi/7zhJOEmAxCiBcM7d0uwdGdxLlsCaLzGs8v8NnxIRlfG0N51p5yFaOentQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/fastify"
},
{
"type": "opencollective",
"url": "https://opencollective.com/fastify"
}
],
"license": "MIT"
}
}
}
{
"name": "fastify-error-sample",
"version": "1.0.0",
"private": true,
"type": "module",
"dependencies": {
"@fastify/error": "4.2.0"
}
}
{
"schemaVersion": 1,
"goal": "verify @fastify/error.FastifyError in pkg:npm/%40fastify/error@4.2.0",
"kind": "HOW",
"packages": [
"pkg:npm/%40fastify/error@4.2.0"
],
"symbols": [
"@fastify/error.FastifyError"
]
}
import assert from 'node:assert/strict'
import { createError, FastifyError } from '@fastify/error'
// 1. Direct instantiation of generic FastifyError (with and without `new`)
const genericErr = new FastifyError()
assert.equal(genericErr.name, 'FastifyError')
assert.equal(genericErr.code, 'FST_ERR')
assert.equal(genericErr.message, 'Fastify Error')
assert.equal(genericErr.statusCode, 500)
assert.equal(genericErr.toString(), 'FastifyError [FST_ERR]: Fastify Error')
assert.ok(genericErr instanceof Error)
assert.ok(genericErr instanceof FastifyError)
const genericNoNew = FastifyError()
assert.ok(genericNoNew instanceof FastifyError)
assert.equal(genericNoNew.code, 'FST_ERR')
// 2. Custom error constructor created via createError is an instance of FastifyError via Symbol.hasInstance
const CustomError = createError('FST_ERR_CUSTOM', 'Custom failure: %s (%d)', 400)
const rootCause = new Error('underlying reason')
const customErr = new CustomError('invalid input', 42, { cause: rootCause })
assert.equal(customErr.name, 'FastifyError')
assert.equal(customErr.code, 'FST_ERR_CUSTOM')
assert.equal(customErr.statusCode, 400)
assert.equal(customErr.message, 'Custom failure: invalid input (42)')
assert.equal(customErr.cause, rootCause)
assert.equal(customErr.toString(), 'FastifyError [FST_ERR_CUSTOM]: Custom failure: invalid input (42)')
assert.ok(customErr instanceof Error)
assert.ok(customErr instanceof CustomError)
assert.ok(customErr instanceof FastifyError)
// 3. Plain Error is not an instance of FastifyError
assert.equal(new Error('plain') instanceof FastifyError, false)
assert.equal(genericErr instanceof CustomError, false)
Origin Seeder
anonymous