{"record":{"id":"0455c50f55a97115","repo":"gitbutlerapp/gitbutler","slug":"fetch-timestamp-does-not-fit-in-the-database-err","errorCode":null,"errorMessage":"fetch timestamp does not fit in the database: {err}","messagePattern":"fetch timestamp does not fit in the database: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-api/src/workspace.rs","lineNumber":336,"sourceCode":"            let joined = failures\n                .iter()\n                .map(|(remote, err)| format!(\"{remote}: {err}\"))\n                .collect::<Vec<_>>()\n                .join(\"\\n\");\n            let err = anyhow::anyhow!(joined);\n            match code {\n                Some(code) => err.context(code),\n                None => err,\n            }\n        })\n    })();\n\n    let attempted_ms = SystemTime::now()\n        .duration_since(UNIX_EPOCH)\n        .map_err(|err| anyhow::anyhow!(\"system clock is before the Unix epoch: {err}\"))?\n        .as_millis()\n        .try_into()\n        .map_err(|err| anyhow::anyhow!(\"fetch timestamp does not fit in the database: {err}\"))?;\n    let _guard = ctx.exclusive_worktree_access();\n    match &fetch_result {\n        Ok(ignored_errors) => ctx\n            .db\n            .get_cache_mut()?\n            .fetch_status_mut()\n            .record_success(attempted_ms, ignored_errors.as_deref())?,\n        Err(err) => ctx\n            .db\n            .get_cache_mut()?\n            .fetch_status_mut()\n            .record_failure(attempted_ms, &format!(\"{err:#}\"))?,\n    }\n\n    // A partial failure may still have updated some remote refs.\n    ctx.invalidate_workspace_cache()?;\n    prune_missing_branch_stack_order(ctx)?;\n    fetch_result.map(|_| ())","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/workspace.rs#L318-L354","documentation":"After computing the epoch-millisecond fetch timestamp, the value is cast with `try_into()` into the integer type stored in the database (e.g. i64). If the millisecond value does not fit that type, this error is raised.","triggerScenarios":"Calling `workspace_fetch` when `SystemTime::now()` since epoch in milliseconds exceeds the target database column/field integer range — practically only with far-future system clocks (year ~292 million+ for i64, or smaller storage types sooner).","commonSituations":"System clock wildly wrong (set to year 3000+ by misconfiguration or a prank/test); database schema stores timestamps in a narrower integer type.","solutions":["Fix the system clock to the current date/time","Verify the database schema's timestamp column type is large enough (i64 millis)","Retry the fetch after correcting the clock"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure the current timestamp fits the storage integer type\nlet ms: i64 = std::time::SystemTime::now()\n    .duration_since(std::time::UNIX_EPOCH)?\n    .as_millis()\n    .try_into()\n    .map_err(|_| anyhow!(\"clock far in the future; timestamp overflow\"))?;","typeGuard":null,"tryCatchPattern":"match workspace_fetch(ctx).await {\n    Err(e) if e.to_string().contains(\"fetch timestamp does not fit\") => {\n        eprintln!(\"system clock is wildly wrong; correct date and retry\");\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Keep system clocks accurate (NTP)","Use i64 millis (or wider) columns for timestamps in schemas","Sanity-check system time at startup"],"tags":["time","database","integer-overflow"],"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"}