Netflix/Hystrix · error · UnsupportedOperationException

No fallback available.

Error message

No fallback available.

What it means

The default HystrixCommand.getFallback() throws UnsupportedOperationException('No fallback available.'); it fires whenever a command fails (exception, timeout, short-circuit, thread-pool rejection, semaphore rejection) and no fallback was overridden. Hystrix then surfaces it as HystrixRuntimeException with FailureType.COMMAND_EXCEPTION / FALLBACK_MISSING semantics.

Source

Thrown at hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommand.java:293

     */
    protected abstract R run() throws Exception;

    /**
     * If {@link #execute()} or {@link #queue()} fails in any way then this method will be invoked to provide an opportunity to return a fallback response.
     * <p>
     * This should do work that does not require network transport to produce.
     * <p>
     * In other words, this should be a static or cached result that can immediately be returned upon failure.
     * <p>
     * If network traffic is wanted for fallback (such as going to MemCache) then the fallback implementation should invoke another {@link HystrixCommand} instance that protects against that network
     * access and possibly has another level of fallback that does not involve network access.
     * <p>
     * DEFAULT BEHAVIOR: It throws UnsupportedOperationException.
     * 
     * @return R or throw UnsupportedOperationException if not implemented
     */
    protected R getFallback() {
        throw new UnsupportedOperationException("No fallback available.");
    }

    @Override
    final protected Observable<R> getExecutionObservable() {
        return Observable.defer(new Func0<Observable<R>>() {
            @Override
            public Observable<R> call() {
                try {
                    return Observable.just(run());
                } catch (Throwable ex) {
                    return Observable.error(ex);
                }
            }
        }).doOnSubscribe(new Action0() {
            @Override
            public void call() {
                // Save thread on which we get subscribed so that we can interrupt it later if needed
                executionThread.set(Thread.currentThread());

View on GitHub (pinned to 5ce3bc58c3)

Solutions

  1. Override getFallback() to return a safe default, cached value, or null
  2. If fallback requires I/O, implement it as another HystrixCommand (with its own fallback) per the Javadoc guidance
  3. If no fallback makes sense, catch HystrixRuntimeException at the call site and degrade the caller's behavior
  4. Tune timeouts/retries on the primary path to reduce frequency of hitting the fallback

Example fix

// before
public class GetUserCommand extends HystrixCommand<User> {
  protected User run() { return userClient.get(id); } }
// after
public class GetUserCommand extends HystrixCommand<User> {
  protected User run() { return userClient.get(id); }
  @Override protected User getFallback() { return User.CACHED_DEFAULT; } }
Defensive patterns

Strategy: fallback

Validate before calling

null

Type guard

// detect a missing fallback before failure (reflection/utility in tests)
// production guard: override getFallback() in every command, even if it returns null

Try / catch

catch (HystrixRuntimeException e) { if ("No fallback available.".equals(e.getMessage()) || (e.getCause() instanceof UnsupportedOperationException && "No fallback available.".equals(e.getCause().getMessage()))) { // degrade caller gracefully } }

Prevention

When it happens

Trigger: A command without a getFallback() override fails for any reason: run() throws, execution times out, circuit breaker is open, thread-pool or semaphore rejects, or bad-request exception occurs — and the fallback path is invoked.

Common situations: Downstream dependency outage on a command where no one wrote a fallback; timeouts from slow endpoints on commands intended to 'just work'; adding Hystrix to legacy code and observing raw UnsupportedOperationException inside HystrixRuntimeException on first dependency blip.

Related errors


AI-assisted analysis of Netflix/Hystrix@5ce3bc58c3 (2026-08-14). Data as JSON: /api/errors/3ea9a6cbe761cfec. Report an issue: GitHub.