{"id":48070,"library":"grpc-rich-error-model","title":"gRPC Rich Error Model","description":"Server implementation of the gRPC Rich Error Model for Node.js, providing structured error details like retry info, error info, debug info, and more. Version 0.0.21 is the latest stable release, updated with TypeScript support and matching the gRPC specification. The package fills a gap in the official Node.js gRPC library, which lacks rich error support, unlike gRPC-Web. It integrates seamlessly with @grpc/grpc-js and offers a builder pattern for creating complex error responses.","status":"active","version":"0.0.21","language":"javascript","source_language":"en","source_url":"https://github.com/markelog/grpc-rich-error-model","tags":["javascript","typescript"],"install":[{"cmd":"npm install grpc-rich-error-model","lang":"bash","label":"npm"},{"cmd":"yarn add grpc-rich-error-model","lang":"bash","label":"yarn"},{"cmd":"pnpm add grpc-rich-error-model","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for gRPC client/server integration","package":"@grpc/grpc-js","optional":false},{"reason":"Required for protobuf message serialization","package":"google-protobuf","optional":false}],"imports":[{"note":"Main export for building gRPC status objects with rich error details.","wrong":"import { createStatusBuilder } from 'grpc-rich-error-model/build/src/statusBuilder'","symbol":"createStatusBuilder","correct":"import { createStatusBuilder } from 'grpc-rich-error-model'"},{"note":"CJS require works, but ESM is recommended for TypeScript projects.","wrong":"const StatusBuilder = require('grpc-rich-error-model').StatusBuilder","symbol":"StatusBuilder","correct":"import { StatusBuilder } from 'grpc-rich-error-model'"},{"note":"Helper function to create retry info details.","wrong":"","symbol":"retryInfo","correct":"import { retryInfo } from 'grpc-rich-error-model'"}],"quickstart":{"code":"import * as grpc from '@grpc/grpc-js';\nimport { createStatusBuilder } from 'grpc-rich-error-model';\n\nconst server = new grpc.Server();\nserver.addService(myServiceDefinition, {\n  myMethod: (call, callback) => {\n    const status = createStatusBuilder()\n      .withCode(grpc.status.INVALID_ARGUMENT)\n      .withMessage('Invalid argument')\n      .withDetails([\n        { type: 'type.googleapis.com/google.rpc.RetryInfo', value: { retryDelay: { seconds: 10, nanos: 0 } } }\n      ])\n      .build();\n    callback(status);\n  }\n});\nserver.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), () => {\n  server.start();\n});","lang":"typescript","description":"Creates a gRPC server that returns a rich error with retry info when a method is called."},"warnings":[{"fix":"Use callback(status) where status is the built object.","message":"The built Status object must be passed to gRPC callback as first argument (error), not as metadata.","severity":"gotcha","affected_versions":"*"},{"fix":"Check client library support for rich errors.","message":"Rich error details are only supported on the server side; client libraries may ignore them.","severity":"gotcha","affected_versions":"*"},{"fix":"Upgrade to >=0.0.19 and use createStatusBuilder().","message":"Version 0.0.18 and below used a different API without builder pattern.","severity":"deprecated","affected_versions":"<0.0.19"}],"env_vars":null,"search_vec":"'0.0.21':29 'builder':72 'complex':76 'creat':75 'debug':24 'detail':18 'error':3,11,17,22,58,77 'fill':46 'gap':48 'grpc':1,9,42,53,62 'grpc-web':61 'grpc/grpc-js':68 'implement':6 'info':21,23,25 'integr':65 'javascript':79 'lack':56 'latest':32 'librari':54 'like':19 'match':40 'model':4,12 'node.js':14,52 'offer':70 'offici':51 'packag':45 'pattern':73 'provid':15 'releas':34 'respons':78 'retri':20 'rich':2,10,57 'seamless':66 'server':5 'specif':43 'stabl':33 'structur':16 'support':38,59 'typescript':37,80 'unlik':60 'updat':35 'version':28 'web':63","created_at":"2026-06-07T16:54:46.863678+00:00","updated_at":"2026-06-07T16:54:46.863678+00:00","problems":[{"fix":"Ensure each detail object has type (string) and value (object) properties.","cause":"Details array contains objects without proper type/value structure","error":"TypeError: Cannot read properties of undefined (reading 'map')"},{"fix":"Use grpc.status constants (e.g., grpc.status.INVALID_ARGUMENT).","cause":"Passed non-number or invalid code to withCode()","error":"Error: Invalid argument: code must be a gRPC status code number"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/markelog/grpc-rich-error-model#readme","github":"https://github.com/markelog/grpc-rich-error-model","docs":null,"changelog":null,"pypi":null,"npm":"grpc-rich-error-model","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}