gitbutlerapp/gitbutler · error

Failed to list actions

Error message

Failed to list actions: {e}

What it means

list_actions queries the butler_actions table for a paginated listing. If the underlying list(offset, limit) call errors, the failure is wrapped as 'Failed to list actions: {e}'. Rows that fail conversion into ButlerAction are intentionally skipped, so this error only fires on genuine query failure.

Solutions

  1. Read the wrapped '{e}' cause and address the underlying SQL/db error
  2. Verify the project database opens and its schema matches the current app version
  3. Retry after releasing concurrent db locks (close other GitButler instances)
  4. Sanitize offset/limit arguments before calling
Defensive patterns

Strategy: try-catch

Validate before calling

// validate pagination args first
if offset < 0 || limit <= 0 || limit > 1000 { return Err(anyhow!("bad pagination")); }

Try / catch

match list_actions(db, offset, limit) {
  Ok(listing) => listing,
  Err(e) if e.to_string().contains("Failed to list actions") => {
    // check db lock/schema per inner '{e}', return empty listing or retry
    ActionListing::default()
  }
  Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling list_actions with a DbHandle whose database is locked, missing, or has an incompatible schema; SQL error during the paginated SELECT with the given offset/limit.

Common situations: Corrupt or migrated-incompatibly db file; negative/huge offset/limit causing SQL issues; concurrent writer locks; disk/IO errors.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/dfd69085de60cad6. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-action/src/action.rs:195

        snapshot_before,
        snapshot_after,
        response,
        source,
    );
    let id = action.id;
    persist_action(db, action)?;
    Ok(id)
}

/// List persisted Butler actions from `db` using `offset` and `limit` pagination.
///
/// Invalid database rows are skipped to preserve the historical best-effort behavior of the
/// action list endpoint.
pub fn list_actions(db: &DbHandle, offset: i64, limit: i64) -> anyhow::Result<ActionListing> {
    let (total, actions) = db
        .butler_actions()
        .list(offset, limit)
        .map_err(|e| anyhow::anyhow!("Failed to list actions: {e}"))?;

    // Filter out any entries that cannot be converted to ButlerAction
    let actions = actions
        .into_iter()
        .filter_map(|a| TryInto::try_into(a).ok())
        .collect::<Vec<_>>();
    Ok(ActionListing { total, actions })
}

#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ActionListing {
    pub total: i64,
    pub actions: Vec<ButlerAction>,
}

View on GitHub (pinned to 58e5313667)