redis/redis · error

ASKING failed: %s\n

Error message

ASKING failed: %s\n

What it means

Printed by cliSendAsking() when the ASKING command completes but the server returns a REDIS_REPLY_ERROR (reply->str holds the server's error message). Unlike the NULL case at line 1800, the command reached the server but the server rejected it — for example because the node is not configured as a cluster node, is still loading, or the client state is invalid for ASKING.

Source

Thrown at src/redis-cli.c:1806

/* In cluster, if server replies ASK, we will redirect to a different node.
 * Before sending the real command, we need to send ASKING command first. */
static int cliSendAsking(void) {
    redisReply *reply;

    config.cluster_send_asking = 0;
    if (context == NULL) {
        return REDIS_ERR;
    }
    reply = redisCommand(context,"ASKING");
    if (reply == NULL) {
        fprintf(stderr, "\nI/O error\n");
        return REDIS_ERR;
    }
    int result = REDIS_OK;
    if (reply->type == REDIS_REPLY_ERROR) {
        result = REDIS_ERR;
        fprintf(stderr,"ASKING failed: %s\n",reply->str);
    }
    freeReplyObject(reply);
    return result;
}

static void cliPrintContextError(void) {
    if (context == NULL) return;
    fprintf(stderr,"Error: %s\n",context->errstr);
}

static int isInvalidateReply(redisReply *reply) {
    return reply->type == REDIS_REPLY_PUSH && reply->elements == 2 &&
        reply->element[0]->type == REDIS_REPLY_STRING &&
        !strncmp(reply->element[0]->str, "invalidate", 10) &&
        reply->element[1]->type == REDIS_REPLY_ARRAY;
}

/* Special display handler for RESP3 'invalidate' messages.

View on GitHub (pinned to 3acc0c49cf)

Solutions

  1. Read the full error text after 'ASKING failed:' — it names the exact server-side reason.
  2. Confirm you are connected to a real cluster node: `CLUSTER INFO` should show cluster_enabled:1.
  3. Verify slot ownership and node roles with `CLUSTER NODES` / `CLUSTER SLOTS`.
  4. If the node is loading, wait for it to finish and retry the command.
Defensive patterns

Strategy: fallback

Validate before calling

/* Only issue ASKING inside a cluster and only after a real ASK redirect. */
if (!in_cluster_mode) return REDIS_ERR;                /* not a cluster: ASKING is invalid */
if (!pending_ask_redirect) return REDIS_ERR;           /* no ASK in flight: nothing to satisfy */

Try / catch

redisReply *r = redisCommand(context, "ASKING");
if (r == NULL) { redisReconnect(context); return REDIS_ERR; }      /* I/O error */
if (r->type == REDIS_REPLY_ERROR) {                                 /* ASKING rejected */
    freeReplyObject(r);
    refreshClusterSlots();            /* topology moved: reload slot->node map */
    return reissueOnOwner(original_cmd, slot);  /* fallback: run cmd on the real owner */
}
freeReplyObject(r);

Prevention

When it happens

Trigger: A cluster redirect (ASK) targets a node that is not a cluster master, or the server replies with an error to ASKING such as 'ERR This instance has cluster support disabled' or a loading/role-related error.

Common situations: Pointing a cluster-mode redis-cli at a standalone (non-cluster) server; cluster topology changed (resharding/failover) so the redirect target no longer owns the slot; node still loading the dataset after restart; a misconfigured or partially-set-up cluster.

Related errors


AI-assisted analysis of redis/redis@3acc0c49cf (2026-08-01). Data as JSON: /data/errors/b7fd85880e0e632d.json. Report an issue: GitHub.