usebruno/bruno · error · Error

Failed to refresh methods and method

Error message

Failed to refresh methods and method ${methodPath} not found

What it means

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.

Solutions

  1. Confirm request.method exactly matches "/<Package>.<Service>/<Method>" as declared in the proto (case-sensitive, fully qualified).
  2. Enable server reflection (e.g. register grpc.reflection.v1alpha.ServerReflection) so #refreshMethods can enumerate services, or supply the correct local proto/protoPath.
  3. Verify includeDirs in the request resolve to the proto file that actually declares the method.
  4. Re-import the proto in the collection UI so the cached method list is rebuilt.

Example fix

// before
request.method = '/UserService/GetUser'; // missing package prefix -> not found

// after
request.method = '/acme.users.UserService/GetUser'; // fully qualified, matches proto
Defensive patterns

Strategy: try-catch

Validate before calling

function isValidMethodPath(p) { return /^\/[A-Za-z0-9_.]+\/[A-Za-z0-9_]+$/.test(p); }
// before request: ensure path exists in the reflected service list
const services = await client.listServices();
const exists = services.some(s => s.method.some(m => '/' + s.fullName + '/' + m.name === methodPath));
if (!exists) throw new Error(`method ${methodPath} not in reflected services`);

Try / catch

try { method = this.#getMethodFromPath(methodPath); }
catch { const ok = await this.#refreshMethods({...}); if (!ok) throw new Error(`Failed to refresh methods and method ${methodPath} not found`); method = this.#getMethodFromPath(methodPath); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13). Data as JSON: /api/errors/0584bab72b353f11. Report an issue: GitHub.

Appendix: source

Thrown at packages/bruno-requests/src/grpc/grpc-client.js:637

        url: request.url,
        headers: request.headers,
        protoPath: request.protoPath,
        collectionPath: collection.pathname,
        collectionUid: collection.uid,
        certificates: {
          ca: rootCertificate,
          cert: certificateChain,
          key: privateKey,
          passphrase,
          pfx
        },
        verifyOptions,
        includeDirs,
        proxyConfig
      });

      if (!refreshSuccess) {
        throw new Error(`Failed to refresh methods and method ${methodPath} not found`);
      }

      // Try to get the method again after refresh
      try {
        method = this.#getMethodFromPath(methodPath);
      } catch (refreshError) {
        throw refreshError;
      }
    }

    // Extract user-agent from headers if provided (case-insensitive)
    // Set it as grpc.primary_user_agent channel option to prepend to the default user-agent
    const userAgentKey = Object.keys(request.headers).find(
      (key) => key.toLowerCase() === 'user-agent'
    );
    const userAgentValue = userAgentKey ? request.headers[userAgentKey] : null;

    // Resolve proxy target and channel options

View on GitHub (pinned to 9bdd81c7bd)