Skip to content

Redis: CONFIG GET databases error aborts the sidebar instead of falling back to 16 #3036

Description

@junghyuneun

What happened?

Connecting to an AWS ElastiCache (Redis OSS, cluster mode disabled) node fails to list databases. The window shows:

CONFIG: ERR unknown command 'CONFIG', with args beginning with: 'GET' 'databases'

ElastiCache removes CONFIG along with bgsave, debug, migrate, replicaof, save, shutdown and sync. It is removed, not ACL-denied, so the server answers with an unknown command error rather than NOPERM.

docs/databases/redis.mdx documents the intended behaviour:

The sidebar then lists one entry per database, db0 upward, counted from the server's own CONFIG GET databases (16 if it does not answer).

The fallback does not cover this case. In Plugins/RedisDriverPlugin/RedisPluginDriver.swift:266-273:

private func databaseCount(on conn: any RedisCommandChannel) async throws -> Int {
    guard conn.supportsDatabaseSelection else { return 1 }
    let reply = try await conn.run(["CONFIG", "GET", "databases"])
    guard let array = reply.arrayValue, array.count >= 2, let count = array[1].intValue, count > 0 else {
        return 16
    }
    return count
}

The return 16 guard only catches a successful reply of an unexpected shape. An error reply never reaches it: RedisCommandChannel.run calls throwIfError(name) (Plugins/RedisDriverPlugin/RedisCommandChannel.swift:76-79), and RedisReply.throwIfError (Plugins/RedisDriverPlugin/RedisReply.swift:87-91) throws "\(label): \(message)" — which is where the CONFIG: prefix in the message comes from. Line 268 therefore throws straight out through fetchTables (line 251) and fetchDatabases (lines 368-373).

Cluster-mode connections are unaffected: supportsDatabaseSelection is false, so line 267 returns 1 before the probe runs. Only cluster-mode-disabled nodes hit this.

Steps to reproduce

No ElastiCache account needed — any Redis with the command removed reproduces it exactly:

redis-server --port 6399 --save '' --appendonly no --rename-command CONFIG ''
  1. New Connection > Redis > 127.0.0.1, port 6399, SSL disabled
  2. Save & Connect
  3. The database list fails with the message above

The server side, for reference:

$ redis-cli -p 6399 CONFIG GET databases
ERR unknown command 'CONFIG', with args beginning with: 'GET' 'databases'

Connect and auth themselves are fine — RedisConnectProbe sends no CONFIG. Only database enumeration fails. CONFIG is also the only command in the driver's vocabulary that ElastiCache blocks; INFO, SCAN, SELECT, DBSIZE, TYPE, TTL and the rest are all permitted, so the browser works once the count is known.

Expected behavior

A refused CONFIG GET databases falls back to 16, as the docs describe. Something like:

let reply = (try? await conn.run(["CONFIG", "GET", "databases"])) ?? .null

.null has no arrayValue, so the existing guard supplies the 16.

Worked around locally with a loopback proxy that answers CONFIG GET databases with *2\r\n$9\r\ndatabases\r\n$2\r\n16\r\n (byte-identical to a real Redis reply) and forwards everything else. With that in front of the same endpoint the sidebar lists db0-db15 with correct key counts from INFO keyspace, which confirms the count probe is the only blocker.

Database type

Redis (AWS ElastiCache, Redis OSS, cluster mode disabled)

TablePro version

0.75.0

macOS version & chip

macOS 26.6.2 / Apple Silicon (M1 Pro)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions