Skip to content

fix: handle empty object response from /tasks endpoint#56

Merged
joshrotenberg merged 1 commit intomainfrom
fix/tasks-empty-response-deserialization
Feb 6, 2026
Merged

fix: handle empty object response from /tasks endpoint#56
joshrotenberg merged 1 commit intomainfrom
fix/tasks-empty-response-deserialization

Conversation

@joshrotenberg
Copy link
Copy Markdown
Contributor

Summary

  • Fix deserialization error when /tasks API returns {} (empty object) instead of [] (empty array) when there are no active tasks
  • Use get_raw() and pattern match on Value::Array vs fallback to empty Vec
  • The existing get_all_tasks_raw() method was already unaffected since it returns raw JSON

Context

The Redis Cloud API inconsistently returns {} when there are no tasks and [{...}] when tasks exist. The previous implementation used self.client.get("/tasks") which tries to deserialize directly into Vec<TaskStateUpdate>, failing with:

invalid type: map, expected a sequence

Test plan

  • All existing tests pass (cargo test --lib --all-features and cargo test --test '*' --all-features)
  • Verify via MCP tool call against live account with no active tasks

The Redis Cloud API returns an empty object `{}` instead of an empty
array `[]` when there are no active tasks. This caused a deserialization
error ("invalid type: map, expected a sequence"). Use `get_raw()` and
pattern match on the response shape to handle both cases.
@joshrotenberg joshrotenberg merged commit 3e8573c into main Feb 6, 2026
8 checks passed
@joshrotenberg joshrotenberg deleted the fix/tasks-empty-response-deserialization branch March 19, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant