{"id":18687,"library":"problem-details-http","title":"problem-details-http","description":"Library for HTTP problem details (RFC 7807) error responses. Current stable version is 2.0.0, updated frequently via GitHub. Supports building and sending consistent error payloads with optional extension members. Differentiator: fluent builder pattern, defaults for status codes and titles, TypeScript types included, zero dependencies.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/carlosupreme/problem-details-http","tags":["javascript","problem-details","errors","http","http-errors","api-errors","typescript"],"install":[{"cmd":"npm install problem-details-http","lang":"bash","label":"npm"},{"cmd":"yarn add problem-details-http","lang":"bash","label":"yarn"},{"cmd":"pnpm add problem-details-http","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package; CommonJS not supported.","wrong":"const PDBuilder = require('problem-details-http')","symbol":"PDBuilder","correct":"import { PDBuilder } from 'problem-details-http'"},{"note":"Default import not documented; prefer named import { PDBuilder }.","wrong":"","symbol":"default","correct":"import problemDetailsHttp from 'problem-details-http'"},{"note":"TypeScript type export for type-checking problem detail objects.","wrong":"","symbol":"ProblemDetail","correct":"import type { ProblemDetail } from 'problem-details-http'"}],"quickstart":{"code":"import { PDBuilder } from 'problem-details-http';\n\nconst pd = PDBuilder.fromDetail('Resource not found')\n  .type('https://example.com/errors/not-found')\n  .title('Not Found')\n  .status(404)\n  .instance('/api/users/123')\n  .build();\n\nconsole.log(pd);\n// {\n//   type: 'https://example.com/errors/not-found',\n//   status: 404,\n//   title: 'Not Found',\n//   detail: 'Resource not found',\n//   instance: '/api/users/123'\n// }","lang":"typescript","description":"Creates a problem details object using the builder pattern with default or custom values."},"warnings":[{"fix":"Change `import problemDetailsHttp from 'problem-details-http'` to `import { PDBuilder } from 'problem-details-http'`.","message":"v2.0: Default import removed; must use named import { PDBuilder }.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Always start with `PDBuilder.fromDetail('...')`.","message":"PDBuilder.fromDetail() is the only entry point; PDBuilder constructor is private.","severity":"gotcha","affected_versions":"*"},{"fix":"Use `.status()` instead of `.setStatus()`.","message":"The `setStatus` method was renamed to `status` in v1.5, but old name still works.","severity":"deprecated","affected_versions":">=1.5.0 <2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install problem-details-http` (not --save-dev). Add `\"types\": \"dist/index.d.ts\"` to tsconfig.json if needed.","cause":"Package installed as devDependency or not installed; or missing types.","error":"Cannot find module 'problem-details-http' or its corresponding type declarations."},{"fix":"Use `import { PDBuilder } from 'problem-details-http'` or enable ES modules in project.","cause":"Using CommonJS require with ESM-only package.","error":"TypeError: PDBuilder.fromDetail is not a function"},{"fix":"Replace `.setStatus()` with `.status()`.","cause":"Upgraded from v1.x to v2.x where `setStatus` was removed.","error":"Property 'setStatus' does not exist on type 'PDBuilder'."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}