Skip to content

bug: --wait does not handle 'processing-error' task status correctly #427

@joshrotenberg

Description

@joshrotenberg

Description

When using --wait flag on async operations, if a task enters processing-error state, the CLI continues to spin indefinitely instead of recognizing it as a terminal error state and displaying the error details.

Steps to Reproduce

# Try to create a database on a subscription that's at capacity
redisctl cloud database create \
  --subscription 2969240 \
  --data '{
    "name": "demo-db",
    "memoryLimitInGb": 1,
    "protocol": "redis"
  }' \
  --wait

Expected Behavior

The command should:

  1. Recognize processing-error as a terminal state
  2. Stop spinning/waiting
  3. Display the error details from the task response
  4. Exit with non-zero status code

Example output should show:

Task 0944fbaa-fa16-4493-9955-b9f5a5bf4e4c: ✗ processing-error

Task Details:
-------------
Status: processing-error
Description: Task request failed during processing. See error information for failure details.
Error: Subscription was not found (404 NOT_FOUND)

Actual Behavior

Command spins indefinitely:

⠁ Task 0944fbaa-fa16-4493-9955-b9f5a5bf4e4c: processing-error [00:00:10]

The spinner continues until timeout (default 300 seconds).

Investigation

Root Cause 1: is_terminal_state() in crates/redisctl/src/commands/cloud/async_utils.rs:224 does not recognize processing-error as a terminal state.

Current code:

fn is_terminal_state(state: &str) -> bool {
    matches!(
        state.to_lowercase().as_str(),
        "completed" | "complete" | "succeeded" | "success" | "failed" | "error" | "cancelled"
    )
}

Should include: "processing-error"

Root Cause 2: print_task_details() doesn't properly extract nested error information from response.error field.

Task response structure:

{
  "status": "processing-error",
  "response": {
    "error": {
      "type": "SUBSCRIPTION_NOT_FOUND",
      "status": "404 NOT_FOUND",
      "description": "Subscription was not found"
    }
  }
}

Proposed Fix

  1. Update is_terminal_state() to include processing-error
  2. Update print_task_details() to extract and display response.error fields
  3. Update wait_for_task() error condition to check for processing-error

Related Code

  • crates/redisctl/src/commands/cloud/async_utils.rs:224 - is_terminal_state()
  • crates/redisctl/src/commands/cloud/async_utils.rs:160 - wait_for_task()
  • crates/redisctl/src/commands/cloud/async_utils.rs:260 - print_task_details()

Verification

# Manual check of task status
redisctl api cloud get /tasks/0944fbaa-fa16-4493-9955-b9f5a5bf4e4c

Shows the task correctly has processing-error status with detailed error in response.error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions