{"id":48015,"library":"grpc-error-status","title":"grpc-error-status","description":"A utility library for decoding gRPC error details from the `grpc-status-details-bin` metadata. Version 1.0.1 (stable). Works with any gRPC client library that enriches errors with the `grpc-status-details-bin` trailer, including `@grpc/grpc-js`. Parses the binary protobuf content into a JavaScript object with typed details (e.g., RetryInfo, DebugInfo). No external runtime dependencies; all required protobuf types are bundled. Simpler alternative to manually using `google-rpc` protobufs.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"github.com/monsterzz/grpc-error-status","tags":["javascript","grpc","protobuf"],"install":[{"cmd":"npm install grpc-error-status","lang":"bash","label":"npm"},{"cmd":"yarn add grpc-error-status","lang":"bash","label":"yarn"},{"cmd":"pnpm add grpc-error-status","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime dependency for decoding protobuf binary data; bundled types rely on protobufjs loading.","package":"protobufjs","optional":false}],"imports":[{"note":"ESM import; package also supports CommonJS require() but with destructuring.","wrong":"const parse = require('grpc-error-status').parse","symbol":"parse","correct":"import { parse } from 'grpc-error-status'"},{"note":"CommonJS require returns the module, not the default export; use destructuring or import * as.","wrong":"const grpcStatus = require('grpc-error-status')","symbol":"default import","correct":"import grpcStatus from 'grpc-error-status'"},{"note":"Both work; the first is more common in CJS codebases.","wrong":"const { parse } = require('grpc-error-status'); const status = parse(err);","symbol":"parse function","correct":"const grpcStatus = require('grpc-error-status'); const status = grpcStatus.parse(err);"}],"quickstart":{"code":"const grpcStatus = require('grpc-error-status');\nconst grpc = require('@grpc/grpc-js');\nconst protoLoader = require('@grpc/proto-loader');\nconst packageDef = protoLoader.loadSync('helloworld.proto');\nconst helloProto = grpc.loadPackageDefinition(packageDef).helloworld;\nconst client = new helloProto.Greeter('localhost:50051', grpc.credentials.createInsecure());\nclient.sayHello({ name: 'you' }, (err, response) => {\n  if (err) {\n    const status = grpcStatus.parse(err);\n    if (status) {\n      console.log('Error details:', status.toObject());\n    } else {\n      console.log('gRPC error:', err.message);\n    }\n    return;\n  }\n  console.log('Greeting:', response.message);\n});","lang":"javascript","description":"Parses a gRPC error from a client call and prints the structured error details."},"warnings":[{"fix":"Check for null explicitly with if (status !== null) or if (status != null).","message":"parse() returns null if the error does not have grpc-status-details-bin metadata, not undefined.","severity":"gotcha","affected_versions":"*"},{"fix":"Ensure your gRPC client is configured to propagate the grpc-status-details-bin trailer (standard in @grpc/grpc-js).","message":"The library only decodes the binary metadata; it does not set up error handling or interceptors.","severity":"gotcha","affected_versions":"*"},{"fix":"Pin protobufjs to v6.x in your project if you encounter issues, or use an alternative like @grpc/grpc-js error handling.","message":"Deprecated: The package uses protobufjs v6 internally; protobufjs v7 may cause compatibility issues.","severity":"breaking","affected_versions":"<=1.0.1"}],"env_vars":null,"search_vec":"'1.0.1':22 'altern':69 'bin':19,39 'binari':45 'bundl':67 'client':28 'content':47 'debuginfo':57 'decod':9 'depend':61 'detail':12,18,38,54 'e.g':55 'enrich':31 'error':3,11,32 'extern':59 'googl':74 'google-rpc':73 'grpc':2,10,16,27,36,78 'grpc-error-status':1 'grpc-status-details-bin':15,35 'grpc/grpc-js':42 'includ':41 'javascript':50,77 'librari':7,29 'manual':71 'metadata':20 'object':51 'pars':43 'protobuf':46,64,76,79 'requir':63 'retryinfo':56 'rpc':75 'runtim':60 'simpler':68 'stabl':23 'status':4,17,37 'trailer':40 'type':53,65 'use':72 'util':6 'version':21 'work':24","created_at":"2026-06-07T16:54:29.422179+00:00","updated_at":"2026-06-07T16:54:29.422179+00:00","problems":[{"fix":"Use const { parse } = require('grpc-error-status'); or import * as grpcStatus from 'grpc-error-status' in ESM.","cause":"Using default import style (import grpcStatus from ...) in CommonJS environment, which gives an object that doesn't have parse function.","error":"TypeError: grpcStatus.parse is not a function"},{"fix":"Check if status is not null before calling toObject().","cause":"parse() returns null and calling .toObject() on null.","error":"Cannot read properties of null (reading 'toObject')"},{"fix":"Ensure grpc-error-status is the only version of protobufjs used, or load types manually before calling parse().","cause":"The protobuf root was not loaded correctly; the bundled types are missing or overridden by another protobufjs instance.","error":"Error: No such type: google.rpc.Status"}],"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":"github.com/monsterzz/grpc-error-status","github":"github.com/monsterzz/grpc-error-status","docs":null,"changelog":null,"pypi":null,"npm":"grpc-error-status","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"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}}