neondatabase/neon · error

Unknown availability state '{s}'

Error message

Unknown availability state '{s}'

What it means

storcon_cli parses its node-availability CLI argument through a FromStr impl on NodeAvailabilityArg that accepts exactly two lowercase strings: active and offline. Any other input fails during argument parsing, before any request reaches the storage controller. The values map to NodeAvailabilityWrapper::Active and NodeAvailabilityWrapper::Offline.

Source

Thrown at control_plane/storcon_cli/src/main.rs:409

            "stop" => Ok(Self(ShardSchedulingPolicy::Stop)),
            _ => Err(anyhow::anyhow!(
                "Unknown scheduling policy '{s}', try active,essential,pause,stop"
            )),
        }
    }
}

#[derive(Debug, Clone)]
struct NodeAvailabilityArg(NodeAvailabilityWrapper);

impl FromStr for NodeAvailabilityArg {
    type Err = anyhow::Error;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s {
            "active" => Ok(Self(NodeAvailabilityWrapper::Active)),
            "offline" => Ok(Self(NodeAvailabilityWrapper::Offline)),
            _ => Err(anyhow::anyhow!("Unknown availability state '{s}'")),
        }
    }
}

async fn wait_for_scheduling_policy<F>(
    client: Client,
    node_id: NodeId,
    timeout: Duration,
    f: F,
) -> anyhow::Result<NodeSchedulingPolicy>
where
    F: Fn(NodeSchedulingPolicy) -> bool,
{
    let waiter = tokio::time::timeout(timeout, async move {
        loop {
            let node = client
                .dispatch::<(), NodeDescribeResponse>(
                    Method::GET,

View on GitHub (pinned to 8f60b04da4)

Solutions

  1. Re-run with one of the exact lowercase values: active, offline
  2. Run storcon_cli <subcommand> --help to confirm which flag expects availability vs scheduling values
  3. If you meant scheduling behavior, pass active/essential/pause/stop to the scheduling flag instead

Example fix

# before
storcon_cli node configure --node-id 1 --availability down
# after
storcon_cli node configure --node-id 1 --availability offline
Defensive patterns

Strategy: validation

Validate before calling

fn validate_availability(value: &str) -> Result<(), String> {
    match value {
        "active" | "offline" => Ok(()),
        _ => Err(format!("invalid availability state '{value}', expected 'active' or 'offline'")),
    }
}

Type guard

fn is_valid_availability_state(s: &str) -> bool {
    matches!(s, "active" | "offline")
}

Prevention

When it happens

Trigger: Running a storcon_cli subcommand that takes an availability flag with a value other than 'active' or 'offline', e.g. 'available', 'down', 'Active', or a scheduling-policy word like 'pause'. Clap reports the anyhow error from NodeAvailabilityArg::from_str.

Common situations: Typos or wrong casing; guessing plausible state names ('down', 'unavailable'); confusing availability with scheduling policy (active/essential/pause/stop) and passing the wrong vocabulary to this flag.

Related errors


AI-assisted analysis of neondatabase/neon@8f60b04da4 (2026-08-16). Data as JSON: /api/errors/10e3f8f015b062a8. Report an issue: GitHub.