Netflix/Hystrix · error · IllegalStateException
'https://github.com/Netflix/Hystrix/issues/1458' - no valid
Error message
'https://github.com/Netflix/Hystrix/issues/1458' - no valid annotation found for:
{} What it means
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.
Source
Thrown at hystrix-contrib/hystrix-javanica/src/main/java/com/netflix/hystrix/contrib/javanica/aop/aspectj/HystrixCommandAspect.java:293
.observableExecutionMode(hystrixCommand.observableExecutionMode())
.executionType(executionType)
.observable(ExecutionType.OBSERVABLE == executionType)
.build();
}
}
private enum HystrixPointcutType {
COMMAND,
COLLAPSER;
static HystrixPointcutType of(Method method) {
if (method.isAnnotationPresent(HystrixCommand.class)) {
return COMMAND;
} else if (method.isAnnotationPresent(HystrixCollapser.class)) {
return COLLAPSER;
} else {
String methodInfo = getMethodInfo(method);
throw new IllegalStateException("'https://github.com/Netflix/Hystrix/issues/1458' - no valid annotation found for: \n" + methodInfo);
}
}
}
private static Method getAjcMethodFromTarget(JoinPoint joinPoint) {
return getAjcMethodAroundAdvice(joinPoint.getTarget().getClass(), (MethodSignature) joinPoint.getSignature());
}
private static Class<?> getFirstGenericParameter(Type type) {
return getFirstGenericParameter(type, 1);
}
private static Class<?> getFirstGenericParameter(final Type type, final int nestedDepth) {
int cDepth = 0;
Type tType = type;
for (int cDept = 0; cDept < nestedDepth; cDept++) {View on GitHub (pinned to 5ce3bc58c3)
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.
Example fix
// before (annotation only on interface)
interface UserService {
@HystrixCommand
User getUser(String id);
}
class UserServiceImpl implements UserService {
public User getUser(String id) { ... } // triggers error under some proxy setups
}
// after
interface UserService {
User getUser(String id);
}
class UserServiceImpl implements UserService {
@HystrixCommand
public User getUser(String id) { ... }
} Defensive patterns
Strategy: try-catch
Validate before calling
// In a smoke test through the actual Spring/proxied bean:
// boolean ok = false;
// try { userService.getUser("1"); ok = true; }
// catch (IllegalStateException e) { if (e.getMessage().contains("issues/1458")) fail("annotation not visible to aspect: " + e.getMessage()); } Try / catch
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. Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- method cannot be annotated with HystrixCommand and HystrixCo
- wrong 'weavingMode' property, supported: " + Arrays.toString
- Collapser method must have one argument: {}
- batch method is absent: {}
- required batch method for collapser is absent, wrong generic
AI-assisted analysis of Netflix/Hystrix@5ce3bc58c3 (2026-08-14).
Data as JSON: /api/errors/5f8d68baaa61d114.
Report an issue: GitHub.