{"record":{"id":"dfd69085de60cad6","repo":"gitbutlerapp/gitbutler","slug":"failed-to-list-actions-e","errorCode":null,"errorMessage":"Failed to list actions: {e}","messagePattern":"Failed to list actions: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-action/src/action.rs","lineNumber":195,"sourceCode":"        snapshot_before,\n        snapshot_after,\n        response,\n        source,\n    );\n    let id = action.id;\n    persist_action(db, action)?;\n    Ok(id)\n}\n\n/// List persisted Butler actions from `db` using `offset` and `limit` pagination.\n///\n/// Invalid database rows are skipped to preserve the historical best-effort behavior of the\n/// action list endpoint.\npub fn list_actions(db: &DbHandle, offset: i64, limit: i64) -> anyhow::Result<ActionListing> {\n    let (total, actions) = db\n        .butler_actions()\n        .list(offset, limit)\n        .map_err(|e| anyhow::anyhow!(\"Failed to list actions: {e}\"))?;\n\n    // Filter out any entries that cannot be converted to ButlerAction\n    let actions = actions\n        .into_iter()\n        .filter_map(|a| TryInto::try_into(a).ok())\n        .collect::<Vec<_>>();\n    Ok(ActionListing { total, actions })\n}\n\n#[derive(Debug, Clone, Serialize)]\n#[serde(rename_all = \"camelCase\")]\npub struct ActionListing {\n    pub total: i64,\n    pub actions: Vec<ButlerAction>,\n}\n","sourceCodeStart":177,"sourceCodeEnd":211,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-action/src/action.rs#L177-L211","documentation":"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.","triggerScenarios":"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.","commonSituations":"Corrupt or migrated-incompatibly db file; negative/huge offset/limit causing SQL issues; concurrent writer locks; disk/IO errors.","solutions":["Read the wrapped '{e}' cause and address the underlying SQL/db error","Verify the project database opens and its schema matches the current app version","Retry after releasing concurrent db locks (close other GitButler instances)","Sanitize offset/limit arguments before calling"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// validate pagination args first\nif offset < 0 || limit <= 0 || limit > 1000 { return Err(anyhow!(\"bad pagination\")); }","typeGuard":null,"tryCatchPattern":"match list_actions(db, offset, limit) {\n  Ok(listing) => listing,\n  Err(e) if e.to_string().contains(\"Failed to list actions\") => {\n    // check db lock/schema per inner '{e}', return empty listing or retry\n    ActionListing::default()\n  }\n  Err(e) => return Err(e),\n}","preventionTips":["Keep schema migrations current","Close competing app instances before bulk reads","Clamp offset/limit to sane bounds","Use WAL mode to reduce writer/reader contention"],"tags":["database","sqlite","query","pagination"],"backgroundTag":"database-query-failed","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}