Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
problemDetailsHandler
✓ import { problemDetailsHandler } from 'hono-problem-details'
✗ const problemDetailsHandler = require('hono-problem-details')
ESM-only export; CommonJS require will not work. Use named import.
ProblemDetailsError
✓ import { ProblemDetailsError } from 'hono-problem-details'
✗ import ProblemDetailsError from 'hono-problem-details'
Named export, not default. Correct since v0.1.0.
zodProblemDetailsHook
✓ import { zodProblemDetailsHook } from 'hono-problem-details/zod'
✗ import { zodProblemDetailsHook } from 'hono-problem-details'
Subpath export added in v0.4.0; do not import from root. Only available if zod peer dependency is installed.
ProblemDetails
✓ import type { ProblemDetails } from 'hono-problem-details'
✗ import { ProblemDetails } from 'hono-problem-details'
Type-only import to avoid runtime issues. Available as type export.
Hono app with problemDetailsHandler error middleware showing RFC 9457 responses for HTTPException, custom ProblemDetailsError, and unhandled errors.
import { Hono } from 'hono';
import { HTTPException } from 'hono/http-exception';
import { problemDetailsHandler, ProblemDetailsError } from 'hono-problem-details';
const app = new Hono();
app.onError(problemDetailsHandler({ autoInstance: true }));
app.get('/ok', (c) => c.text('OK'));
app.get('/not-found', (c) => {
throw new HTTPException(404, { message: 'Resource not found' });
});
app.get('/custom', (c) => {
throw new ProblemDetailsError({
status: 422,
title: 'Validation Failed',
detail: 'The request body is not valid.',
extensions: { errors: [{ field: 'username', message: 'required' }] },
});
});
app.get('/error', (c) => {
throw new Error('Something went wrong');
});
export default app;
Errors
Common errors & fixes
Cannot find module 'hono-problem-details' or its corresponding type declarations.
Missing typesVersions in older versions or incorrect moduleResolution in tsconfig.
fixUpdate hono-problem-details to >=0.1.6 and set tsconfig moduleResolution to 'node16' or 'bundler'.
TypeError: problemDetailsHandler is not a function
CommonJS require used instead of ESM import.
fixUse import { problemDetailsHandler } from 'hono-problem-details' (ESM only). RangeError: Invalid status code: 0
ProblemDetailsError status set to an out-of-range value (e.g., 0 or 1xx).
fixUse a status between 200 and 599. Invalid codes are now clamped to 500 in v0.5.0.
Audit
Dependencies
honorequiredCore framework peer dependency required for middleware integration
zodoptionalOptional integration for Zod validation error binding
valibotoptionalOptional integration for Valibot validation error binding
@hono/zod-openapioptionalOptional integration for OpenAPI schema generation