googleapis/mcp-toolbox · error
error getting result: %s
Error message
error getting result: %s
What it means
RunCommand executes a sequence of Redis commands and converts each reply. After a successful cmd.Run, it calls resp.Result(); if the reply itself carries a Redis-level error value (e.g. the command executed but Redis returned an error result), this error aborts the whole invocation. Note the loop already handles per-command execution errors by writing an error string into the output, so this branch catches Result() extraction failures specifically.
Source
Thrown at internal/sources/redis/redis.go:193
func (s *Source) RunCommand(ctx context.Context, cmds [][]any) (any, error) {
// Execute commands
responses := make([]*redis.Cmd, len(cmds))
for i, cmd := range cmds {
responses[i] = s.RedisClient().Do(ctx, cmd...)
}
// Parse responses
out := make([]any, len(cmds))
for i, resp := range responses {
if err := resp.Err(); err != nil {
// Add error from each command to `errSum`
errString := fmt.Sprintf("error from executing command at index %d: %s", i, err)
out[i] = errString
continue
}
val, err := resp.Result()
if err != nil {
return nil, fmt.Errorf("error getting result: %s", err)
}
out[i] = convertRedisResult(val)
}
return out, nil
}
// convertRedisResult recursively converts redis results (map[any]any) to be
// JSON-marshallable (map[string]any).
// It converts map[any]any to map[string]any and handles nested structures.
func convertRedisResult(v any) any {
switch val := v.(type) {
case map[any]any:
m := make(map[string]any)
for k, v := range val {
m[fmt.Sprint(k)] = convertRedisResult(v)
}
return mView on GitHub (pinned to 8cc6e09de2)
Solutions
- Read the wrapped %s detail to identify the Redis error (WRONGTYPE, NOAUTH, OOM, READONLY).
- Fix the command/key type mismatch: run `TYPE <key>` and use commands matching the value type.
- If NOAUTH/WRONGPASS, correct the source's username/password configuration.
- If READONLY, redirect writes to the primary or enable READWRITE on the target node.
- If OOM, free memory or raise maxmemory on the Redis server.
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check key types before issuing commands to avoid WRONGTYPE // redis-cli TYPE <key> should match the command family you intend to run
Try / catch
try {
const out = await invokeTool('redis_run_command', { commands: [...] });
} catch (e) {
if (String(e.message).includes('WRONGTYPE')) {
// inspect key type and reissue with a compatible command
} else if (String(e.message).includes('NOAUTH')) {
// fix source credentials and reconfigure
} else {
throw e;
}
} Prevention
- Run `TYPE <key>` before operating on keys to avoid WRONGTYPE.
- Never send write commands to replicas; target primaries.
- Monitor server memory (maxmemory) to avoid OOM rejections.
- Validate the commands array format (['GET','key'] arrays of strings) before invoking.
When it happens
Trigger: A command in the `commands` array succeeds at the go-redis Cmd.Run level but resp.Result() returns a non-nil err — typically a Redis server error surfaced as the reply value, such as WRONGTYPE, OOM, NOAUTH, or a command executed against a replica marked read-only.
Common situations: Calling a list command on a string key (WRONGTYPE); running write commands on a read-only replica; running out of memory (OOM command not allowed); authentication lost mid-session (NOAUTH); Lua/eval errors.
Related errors
- unable to connect to redis cluster: %s
- unable to connect to redis: %s
- description is required for tool %q
- invalid source for %q tool: source %q is not a compatible ty
- error finding YAML files in %q: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/50c3012702a24941.
Report an issue: GitHub.