{"record":{"id":"8b1e33750ba26d15","repo":"gitbutlerapp/gitbutler","slug":"suppression-duration-cannot-exceed-max-suppressio","errorCode":null,"errorMessage":"Suppression duration cannot exceed {MAX_SUPPRESSION_HOURS} hours (30 days)","messagePattern":"Suppression duration cannot exceed (.+?) hours \\(30 days\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-update/src/cache.rs","lineNumber":130,"sourceCode":"///   - Failed to write the updated cache\n///\n/// # Errors\n///\n/// Returns an error if:\n/// - The hours parameter is 0 or greater than 720 (30 days)\n/// - No update check has been performed yet (no cache exists)\n/// - The current version is already up to date (nothing to suppress)\n/// - The cache cannot be written\npub fn suppress_update(cache: &mut but_db::AppCacheHandle, hours: u32) -> anyhow::Result<()> {\n    // Validate input\n    const MAX_SUPPRESSION_HOURS: u32 = 720; // 30 days\n\n    if hours == 0 {\n        anyhow::bail!(\"Suppression duration must be at least 1 hour\");\n    }\n\n    if hours > MAX_SUPPRESSION_HOURS {\n        anyhow::bail!(\"Suppression duration cannot exceed {MAX_SUPPRESSION_HOURS} hours (30 days)\");\n    }\n\n    cache\n        .update_check_mut()?\n        .suppress(hours)\n        .map_err(Into::into)\n}\n","sourceCodeStart":112,"sourceCodeEnd":138,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-update/src/cache.rs#L112-L138","documentation":"`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.","triggerScenarios":"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.","commonSituations":"Enterprise policies asking for permanent suppression; UI offering arbitrarily large values; migrating old settings that stored very long durations.","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."],"exampleFix":"// before\nsuppress_update(&mut cache, 365 * 24)?;\n// after\nconst MAX: u32 = 720;\nsuppress_update(&mut cache, (365 * 24).min(MAX))?;","handlingStrategy":"validation","validationCode":"const MAX_SUPPRESSION_HOURS: u32 = 720;\nif hours > MAX_SUPPRESSION_HOURS { return Err(\"max suppression is 30 days\"); }\nsuppress_update(&mut cache, hours)?;","typeGuard":null,"tryCatchPattern":"// Rust\nmatch suppress_update(&mut cache, hours) {\n    Err(e) if e.to_string().contains(\"cannot exceed\") => {\n        suppress_update(&mut cache, 720)?; // fall back to the cap\n    }\n    r => r?,\n}","preventionTips":["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."],"tags":["update-check","validation","range-check","cache"],"backgroundTag":"value-out-of-range","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"}