neondatabase/neon · error

failed to get list of autovacuum workers: {}

Error message

failed to get list of autovacuum workers: {}

What it means

check() counts autovacuum workers via pg_stat_activity (backend_type = 'autovacuum worker') so a running autovacuum prevents compute suspension. This error means query_one itself failed - the connection broke, the statement timed out, or the server errored. Like other check() failures it results in report_down() and a reconnect attempt on the next monitor tick.

Source

Thrown at compute_tools/src/monitor.rs:342

        const AUTOVACUUM_COUNT_QUERY: &str =
            "select count(*) from pg_stat_activity where backend_type = 'autovacuum worker'";
        match cli.query_one(AUTOVACUUM_COUNT_QUERY, &[]) {
            Ok(r) => match r.try_get::<&str, i64>("count") {
                Ok(num_workers) => {
                    if num_workers > 0 {
                        self.last_active = Some(Utc::now());
                        return Ok(());
                    };
                }
                Err(e) => {
                    return Err(anyhow::anyhow!(
                        "failed to parse autovacuum workers count: {}",
                        e
                    ));
                }
            },
            Err(e) => {
                return Err(anyhow::anyhow!(
                    "failed to get list of autovacuum workers: {}",
                    e
                ));
            }
        }

        Ok(())
    }
}

// Hang on condition variable waiting until the compute status is `Running`.
fn wait_for_postgres_start(compute: &ComputeNode) {
    let mut state = compute.state.lock().unwrap();
    let pg_init_timeout = compute
        .params
        .pg_init_timeout
        .unwrap_or(PG_DEFAULT_INIT_TIMEOUIT);

View on GitHub (pinned to 8f60b04da4)

Solutions

  1. Check the nested error for the underlying cause/SQLSTATE
  2. Single failures self-heal via the monitor reconnect; watch for streaks
  3. Verify Postgres is healthy and pg_stat_activity is queryable
  4. Reduce extreme catalog pressure (autovacuum tuning) if timeouts recur
Defensive patterns

Strategy: retry

Try / catch

match cli.query_one(AUTOVACUUM_COUNT_QUERY, &[]) {
    Ok(r) => { /* parse count, keep alive if > 0 */ }
    Err(e) => { error!("failed to get list of autovacuum workers: {e}"); client = conf.connect(NoTls); }
}

Prevention

When it happens

Trigger: cli.query_one on pg_stat_activity returns Err: dropped connection, statement_timeout, Postgres restart, or server error while catalog stats are churned by heavy autovacuum activity.

Common situations: Busy computes with aggressive autovacuum where stats lookups contend; monitor polls racing Postgres shutdown; flaky connections between compute_ctl and Postgres.

Related errors


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