{"record":{"id":"5f8d68baaa61d114","repo":"Netflix/Hystrix","slug":"https-github-com-netflix-hystrix-issues-1458","errorCode":null,"errorMessage":"'https://github.com/Netflix/Hystrix/issues/1458' - no valid annotation found for: \n{}","messagePattern":"'https://github\\.com/Netflix/Hystrix/issues/1458' - no valid annotation found for: \n(.+?)","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/aop/aspectj/HystrixCommandAspect.java","lineNumber":293,"sourceCode":"                            .observableExecutionMode(hystrixCommand.observableExecutionMode())\n                            .executionType(executionType)\n                            .observable(ExecutionType.OBSERVABLE == executionType)\n                            .build();\n        }\n    }\n\n    private enum HystrixPointcutType {\n        COMMAND,\n        COLLAPSER;\n\n        static HystrixPointcutType of(Method method) {\n            if (method.isAnnotationPresent(HystrixCommand.class)) {\n                return COMMAND;\n            } else if (method.isAnnotationPresent(HystrixCollapser.class)) {\n                return COLLAPSER;\n            } else {\n                String methodInfo = getMethodInfo(method);\n                throw new IllegalStateException(\"'https://github.com/Netflix/Hystrix/issues/1458' - no valid annotation found for: \\n\" + methodInfo);\n            }\n        }\n    }\n\n    private static Method getAjcMethodFromTarget(JoinPoint joinPoint) {\n        return getAjcMethodAroundAdvice(joinPoint.getTarget().getClass(), (MethodSignature) joinPoint.getSignature());\n    }\n\n\n    private static Class<?> getFirstGenericParameter(Type type) {\n        return getFirstGenericParameter(type, 1);\n    }\n\n    private static Class<?> getFirstGenericParameter(final Type type, final int nestedDepth) {\n        int cDepth = 0;\n        Type tType = type;\n\n        for (int cDept = 0; cDept < nestedDepth; cDept++) {","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/Netflix/Hystrix/blob/5ce3bc58c38e7ca60ef2fe0e516e390e294ad941/hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/aop/aspectj/HystrixCommandAspect.java#L275-L311","documentation":"The aspect resolved the intercepted Method but found neither @HystrixCommand nor @HystrixCollapser on it via reflection. This is the guard added for Netflix/Hystrix issue #1458: with certain weaving setups (notably AspectJ compile-time weaving, interface-based proxies, or multiple AOP frameworks layering proxies), the Method object obtained from the join point belongs to a class where the annotation is not visible, and Javanica cannot decide which pipeline to build.","triggerScenarios":"Annotation declared on an interface method while the aspect resolves the implementation method (or vice versa) through an extra proxy layer; method-level annotations combined with another aspect ordering HystrixCommandAspect outermost so the join point target loses the annotation; compile-time weaving (isCompileWeaving) resolving the ajc-generated method without runtime-visible annotations; an annotation-free method somehow matching the pointcut via meta-annotation bridging.","commonSituations":"Spring apps mixing Spring AOP and AspectJ weaving; upgrading hystrix-javanica versions where proxy resolution changed; putting @HystrixCommand only on the interface; using annotation aliases or custom meta-annotations the pointcut does not recognize.","solutions":["Put the annotation directly on the concrete class method, not only on an interface declaration.","Simplify/clarify AOP setup: prefer either runtime Spring AOP or compile-time weaving, not proxies stacking both, and check aspect order so HystrixCommandAspect sees the real target.","Upgrade hystrix-javanica to the latest 1.5.x, where several #1458 proxy-resolution fixes landed.","As a diagnostic, print method.isAnnotationPresent(...) for both annotations from a breakpoint inside the aspect to see which Method object is being inspected."],"exampleFix":"// before (annotation only on interface)\ninterface UserService {\n    @HystrixCommand\n    User getUser(String id);\n}\nclass UserServiceImpl implements UserService {\n    public User getUser(String id) { ... }   // triggers error under some proxy setups\n}\n\n// after\ninterface UserService {\n    User getUser(String id);\n}\nclass UserServiceImpl implements UserService {\n    @HystrixCommand\n    public User getUser(String id) { ... }\n}","handlingStrategy":"try-catch","validationCode":"// In a smoke test through the actual Spring/proxied bean:\n// boolean ok = false;\n// try { userService.getUser(\"1\"); ok = true; }\n// catch (IllegalStateException e) { if (e.getMessage().contains(\"issues/1458\")) fail(\"annotation not visible to aspect: \" + e.getMessage()); }","typeGuard":null,"tryCatchPattern":"try { proxiedBean.call(); } catch (IllegalStateException e) { if (e.getMessage().contains(\"no valid annotation found\")) { log.error(\"Hystrix annotation not visible on {} — check AOP weaving/interface annotations\", method); throw; } throw e; } — always rethrow; this is wiring, not runtime data.","preventionTips":["Put @HystrixCommand/@HystrixCollapser on concrete class methods, never only on interfaces.","Exercise every annotated method once in a @SpringBootTest canary so proxy/annotation visibility problems surface in CI, not production.","Avoid stacking Spring AOP proxies and AspectJ compile-time weaving on the same beans; pin one strategy project-wide."],"tags":["hystrix","javanica","aop","aspectj","proxy","issue-1458"],"backgroundTag":null,"analyzedSha":"5ce3bc58c38e7ca60ef2fe0e516e390e294ad941","analyzedAt":"2026-08-14T10:55:35.600Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}