gitbutlerapp/gitbutler · error
Suppression duration cannot exceed
Error message
Suppression duration cannot exceed {MAX_SUPPRESSION_HOURS} hours (30 days) What it means
`suppress_update` caps auto-update suppression at `MAX_SUPPRESSION_HOURS` (720 hours = 30 days). Durations above the cap are rejected so update checks cannot be disabled indefinitely through the cache API.
Solutions
- Pass at most 720 hours (30 days) and re-prompt/re-suppress after the period elapses.
- Clamp before calling: `let hours = hours.min(720);`.
- Remove the overly long suppression option from the UI/config and use repeated 30-day suppressions instead.
Example fix
// before suppress_update(&mut cache, 365 * 24)?; // after const MAX: u32 = 720; suppress_update(&mut cache, (365 * 24).min(MAX))?;
Defensive patterns
Strategy: validation
Validate before calling
const MAX_SUPPRESSION_HOURS: u32 = 720;
if hours > MAX_SUPPRESSION_HOURS { return Err("max suppression is 30 days"); }
suppress_update(&mut cache, hours)?; Try / catch
// Rust
match suppress_update(&mut cache, hours) {
Err(e) if e.to_string().contains("cannot exceed") => {
suppress_update(&mut cache, 720)?; // fall back to the cap
}
r => r?,
} Prevention
- Clamp with `.min(720)` before calling.
- Model long-term suppression as repeated 30-day suppressions, not one huge value.
- Validate user/config-provided durations against the 720h cap at the input boundary.
When it happens
Trigger: Calling `suppress_update(cache, hours)` with `hours > 720`, e.g. a "disable for a year" option (8760 hours) or an unvalidated user/config-provided value.
Common situations: Enterprise policies asking for permanent suppression; UI offering arbitrarily large values; migrating old settings that stored very long durations.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- Suppression duration must be at least 1 hour
- Aborting due to empty branch name
- Aborting due to empty
- API returned version
- At least one review number is required
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/8b1e33750ba26d15.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-update/src/cache.rs:130
/// - Failed to write the updated cache
///
/// # Errors
///
/// Returns an error if:
/// - The hours parameter is 0 or greater than 720 (30 days)
/// - No update check has been performed yet (no cache exists)
/// - The current version is already up to date (nothing to suppress)
/// - The cache cannot be written
pub fn suppress_update(cache: &mut but_db::AppCacheHandle, hours: u32) -> anyhow::Result<()> {
// Validate input
const MAX_SUPPRESSION_HOURS: u32 = 720; // 30 days
if hours == 0 {
anyhow::bail!("Suppression duration must be at least 1 hour");
}
if hours > MAX_SUPPRESSION_HOURS {
anyhow::bail!("Suppression duration cannot exceed {MAX_SUPPRESSION_HOURS} hours (30 days)");
}
cache
.update_check_mut()?
.suppress(hours)
.map_err(Into::into)
}
View on GitHub (pinned to 58e5313667)