usebruno/bruno · error · Error
Unsupported method type: ${methodType}
Error message
Unsupported method type: ${methodType} What it means
Thrown by GrpcClient.#handleConnection when the resolved gRPC method type does not match one of the four supported RPC patterns (unary, client-streaming, server-streaming, bidi-streaming). The type is derived by #getMethodType from the method definition's requestStream/responseStream boolean flags, so an undefined or malformed method object reaches the default branch.
Source
Thrown at packages/bruno-requests/src/grpc/grpc-client.js:494
* @param {Object} options.metadata - The metadata object
*/
#handleConnection(options) {
const methodType = this.#getMethodType(options.method);
switch (methodType) {
case 'unary':
this.#handleUnaryResponse(options);
break;
case 'client-streaming':
this.#handleClientStreamingResponse(options);
break;
case 'server-streaming':
this.#handleServerStreamingResponse(options);
break;
case 'bidi-streaming':
this.#handleBidiStreamingResponse(options);
break;
default:
throw new Error(`Unsupported method type: ${methodType}`);
}
}
/**
* Handle unary responses
*/
#handleUnaryResponse({ client, requestId, requestPath, method, messages, metadata, collectionUid }) {
const rpc = client.makeUnaryRequest(
requestPath,
method.requestSerialize,
method.responseDeserialize,
messages[0],
metadata,
(error, res) => {
this.eventCallback('grpc:response', requestId, collectionUid, { error, res });
}
);
this.#addConnection(requestId, { rpc, client });View on GitHub (pinned to 9bdd81c7bd)
Solutions
- Force-refresh the service definition (re-run server reflection / re-import the proto) so #getMethodType receives a well-formed method with requestStream and responseStream.
- Verify request.method points to a valid '/Service/Method' path that exists in the loaded proto, then retry.
- Clear cached gRPC metadata from local storage and re-open the collection so methods are re-parsed from the proto file.
- Upgrade @grpc/grpc-js and bruno-requests to matching versions if the ServiceType object shape differs across releases.
Example fix
// before: method came from stale local-storage cache (lost requestSerialize + stream flags)
const method = cachedMethod; // { path: '/Foo/Bar' } -> throws
// after: re-resolve from a fresh proto load / reflection so flags are present
const method = await client.#getMethodFromPath('/Foo/Bar');
// method now has requestStream:false, responseStream:false, requestSerialize, responseDeserialize Defensive patterns
Strategy: type-guard
Validate before calling
const SUPPORTED = new Set(['unary','client-streaming','server-streaming','bidi-streaming']);
function assertMethodType(method) {
const has = typeof method?.requestStream === 'boolean' && typeof method?.responseStream === 'boolean';
if (!has) throw new Error('method is missing requestStream/responseStream booleans');
const t = String(method.requestStream) + String(method.responseStream);
const type = t==='falsefalse'?'unary':t==='truefalse'?'client-streaming':t==='falsetrue'?'server-streaming':'bidi-streaming';
if (!SUPPORTED.has(type)) throw new Error(`Unsupported method type: ${type}`);
return type;
} Type guard
function isWellFormedGrpcMethod(m): m is { requestStream:boolean; responseStream:boolean; requestSerialize:Function; responseDeserialize:Function } {
return !!m && typeof m.requestStream==='boolean' && typeof m.responseStream==='boolean' && typeof m.requestSerialize==='function' && typeof m.responseDeserialize==='function';
} Try / catch
try { this.#handleConnection(options); }
catch (e) { if (/Unsupported method type/.test(e.message)) { await this.#refreshMethods({...}); /* retry once */ } else throw e; } Prevention
- Always resolve methods via reflection or a fresh proto parse; never trust serialized method objects from local storage that lost their functions.
- Validate the method object's stream flags before dispatch.
- Re-import the proto whenever the service definition changes.
When it happens
Trigger: A gRPC request is dispatched where options.method lacks requestStream/responseStream, or both are non-boolean (e.g. the method definition loaded from local storage lost its functions during serialization, or reflection returned a stub method without stream flags).
Common situations: Stale method metadata cached in local storage after a proto change; a corrupt reflection response; calling a request whose proto was swapped but the method path was not re-resolved; downgrade of grpc-js where ServiceType shape changed.
Related errors
- Failed to parse ${context}: ${error.message}
- Workspace path not found
- Invalid Git URL
- Invalid environment: expected an object
- Invalid environment: missing or invalid variables array
AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13).
Data as JSON: /api/errors/57e8d62b402aff96.
Report an issue: GitHub.