alibaba/arthas · error · IllegalArgumentException

incorrect pathinfo: {}

Error message

incorrect pathinfo: {}

What it means

GrpcWebRequestHandler.getClassAndMethod() throws IllegalArgumentException when the gRPC web proxy URL pathInfo does not split into exactly two tokens (class and method). The proxy expects a path of the form '/ClassName/methodName'; any other shape is malformed.

Source

Thrown at labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/GrpcWebRequestHandler.java:114

                inObj = MessageUtils.getInputProtobufObj(asyncStubCall, deframer.getMessageBytes());
            }
            ManagedChannel managedChannel = grpcServiceConnectionManager.getChannel();
            // Invoke the rpc call
            asyncStubCall.invoke(asyncStub, inObj, new GrpcCallResponseReceiver(sendResponse, latch,managedChannel));
            if (!latch.await( 1000, TimeUnit.MILLISECONDS)) {
                logger.warn("grpc call took too long!");
            }
        } catch (Exception e) {
            logger.error("try to invoke grpc serivce error, uri: {}", req.uri(), e);
            sendResponse.writeError(Status.UNAVAILABLE.withCause(e));
        }
    }

    private Pair<String, String> getClassAndMethod(String pathInfo) throws IllegalArgumentException {
        // pathInfo starts with "/". ignore that first char.
        String[] rpcClassAndMethodTokens = pathInfo.substring(1).split("/");
        if (rpcClassAndMethodTokens.length != 2) {
            throw new IllegalArgumentException("incorrect pathinfo: " + pathInfo);
        }

        String rpcClassName = rpcClassAndMethodTokens[0];
        String rpcMethodNameRecvd = rpcClassAndMethodTokens[1];
        String rpcMethodName = rpcMethodNameRecvd.substring(0, 1).toLowerCase() + rpcMethodNameRecvd.substring(1);
        return new Pair<>(rpcClassName, rpcMethodName);
    }

    private Class<?> getClassObject(String className) {
        Class rpcClass = null;
        try {
            rpcClass = Class.forName(className + "Grpc");
        } catch (ClassNotFoundException e) {
            logger.info("no such class " + className);
        }
        return rpcClass;
    }

View on GitHub (pinned to 21cf2e9ba5)

Solutions

  1. Correct the client request URL to the '/ClassName/methodName' format expected by the proxy.
  2. Check the reverse proxy / ingress path-rewrite rules to ensure the original two-segment path is preserved.
  3. Log the incoming pathInfo at DEBUG level to see exactly what the proxy receives and trace where it diverges.

Example fix

// before: client sends wrong path
// GET /grpc-web/ClassName  (missing method)

// after: include both segments
// GET /grpc-web/ClassName/methodName
Defensive patterns

Strategy: validation

Validate before calling

String[] tokens = pathInfo.substring(1).split("/");
if (tokens.length != 2) {
    throw new IllegalArgumentException(
        "Path must be '/ClassName/methodName', got: " + pathInfo);
}
// proceed to getClassAndMethod(pathInfo)

Try / catch

try {
    handler.handle(req);
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("incorrect pathinfo")) {
        sendResponse.writeError(Status.INVALID_ARGUMENT.withDescription(e.getMessage()));
    } else { throw e; }
}

Prevention

When it happens

Trigger: The incoming HTTP request URI path (after stripping the leading '/') splits on '/' into fewer or more than 2 segments — e.g. '/ClassName', '/a/b/c', or an empty path.

Common situations: A client hits the proxy root or a wrong endpoint path; the reverse proxy/ingress rewrites the path incorrectly, adding or removing segments; the gRPC-web encoding strips part of the path; a misconfigured service URL with extra or missing path components.

Related errors


AI-assisted analysis of alibaba/arthas@21cf2e9ba5 (2026-08-14). Data as JSON: /api/errors/587d841d30619a75. Report an issue: GitHub.