{"record":{"id":"0584bab72b353f11","repo":"usebruno/bruno","slug":"failed-to-refresh-methods-and-method-methodpath","errorCode":null,"errorMessage":"Failed to refresh methods and method ${methodPath} not found","messagePattern":"Failed to refresh methods and method (.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-requests/src/grpc/grpc-client.js","lineNumber":637,"sourceCode":"        url: request.url,\n        headers: request.headers,\n        protoPath: request.protoPath,\n        collectionPath: collection.pathname,\n        collectionUid: collection.uid,\n        certificates: {\n          ca: rootCertificate,\n          cert: certificateChain,\n          key: privateKey,\n          passphrase,\n          pfx\n        },\n        verifyOptions,\n        includeDirs,\n        proxyConfig\n      });\n\n      if (!refreshSuccess) {\n        throw new Error(`Failed to refresh methods and method ${methodPath} not found`);\n      }\n\n      // Try to get the method again after refresh\n      try {\n        method = this.#getMethodFromPath(methodPath);\n      } catch (refreshError) {\n        throw refreshError;\n      }\n    }\n\n    // Extract user-agent from headers if provided (case-insensitive)\n    // Set it as grpc.primary_user_agent channel option to prepend to the default user-agent\n    const userAgentKey = Object.keys(request.headers).find(\n      (key) => key.toLowerCase() === 'user-agent'\n    );\n    const userAgentValue = userAgentKey ? request.headers[userAgentKey] : null;\n\n    // Resolve proxy target and channel options","sourceCodeStart":619,"sourceCodeEnd":655,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-requests/src/grpc/grpc-client.js#L619-L655","documentation":"Thrown after #getMethodFromPath fails AND the fallback #refreshMethods (server reflection / proto reload) returns false, meaning the requested methodPath could still not be located in any service definition. The message embeds the offending methodPath for diagnosis.","triggerScenarios":"request.method (e.g. \"/acme.UserService/GetUser\") does not match any fully-qualified method in the proto files or in the reflected service list, and reflection either is unsupported by the server or completed without exposing that method.","commonSituations":"Method renamed or removed in the proto; wrong package/service prefix used; typo in the request method selector; reflection disabled on the server (grpc.reflection.v1alpha not registered); proto includeDirs misconfigured so the wrong .proto was loaded.","solutions":["Confirm request.method exactly matches \"/<Package>.<Service>/<Method>\" as declared in the proto (case-sensitive, fully qualified).","Enable server reflection (e.g. register grpc.reflection.v1alpha.ServerReflection) so #refreshMethods can enumerate services, or supply the correct local proto/protoPath.","Verify includeDirs in the request resolve to the proto file that actually declares the method.","Re-import the proto in the collection UI so the cached method list is rebuilt."],"exampleFix":"// before\nrequest.method = '/UserService/GetUser'; // missing package prefix -> not found\n\n// after\nrequest.method = '/acme.users.UserService/GetUser'; // fully qualified, matches proto","handlingStrategy":"try-catch","validationCode":"function isValidMethodPath(p) { return /^\\/[A-Za-z0-9_.]+\\/[A-Za-z0-9_]+$/.test(p); }\n// before request: ensure path exists in the reflected service list\nconst services = await client.listServices();\nconst exists = services.some(s => s.method.some(m => '/' + s.fullName + '/' + m.name === methodPath));\nif (!exists) throw new Error(`method ${methodPath} not in reflected services`);","typeGuard":null,"tryCatchPattern":"try { method = this.#getMethodFromPath(methodPath); }\ncatch { const ok = await this.#refreshMethods({...}); if (!ok) throw new Error(`Failed to refresh methods and method ${methodPath} not found`); method = this.#getMethodFromPath(methodPath); }","preventionTips":["Keep the method selector in sync with the proto's fully-qualified name.","Enable server reflection so the refresh fallback has a data source.","Pin proto includeDirs so the correct .proto is loaded."],"tags":["grpc","reflection","proto","method-resolution"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}