GitoxideLabs/gitoxide · error · gix_config::value::Error

Integer overflow

Error message

Integer overflow

What it means

When validating the `checkout.workers` config value, the config integer parsed successfully but could not be converted to a decimal machine value without overflow (`Integer::to_decimal()` returned `None`), so a `gix_config::value::Error` with message 'Integer overflow' is produced.

Solutions

  1. Set `checkout.workers` to a value within the machine integer range (e.g. 1–128)
  2. Remove or comment out the invalid value to fall back to the default
  3. Use `git config checkout.workers <n>` to write a validated value

Example fix

// before (.git/config)
[checkout]
	workers = 99999999999999999999
// after
[checkout]
	workers = 4
Defensive patterns

Strategy: validation

Validate before calling

fn valid_workers(s: &str) -> bool {
    s.parse::<i64>().map(|v| v > 0 && v <= 1024).unwrap_or(false)
}
// check before writing checkout.workers to config

Try / catch

match gix::open(path) {
    Err(e) if e.to_string().contains("Integer overflow") => {
        eprintln!("fix checkout.workers in config: {e}");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Setting `checkout.workers` in `.git/config` or an included config to an integer too large for the target type (e.g. `99999999999999999999`).

Common situations: Typos adding extra digits; copy-pasted huge sentinel values; values intended as 'unlimited' written as an enormous number instead of an accepted keyword.

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


AI-assisted analysis of GitoxideLabs/gitoxide@e73179060b (2026-09-08). Data as JSON: /api/errors/3616720cea7d4ea2. Report an issue: GitHub.

Appendix: source

Thrown at gix/src/config/tree/sections/checkout.rs:56

                Ok(None) => Ok(None),
                Err(err) => Err(crate::config::key::Error::from(&super::Checkout::WORKERS).with_source(err)),
            }
        }
    }
}

///
pub mod validate {
    use crate::{bstr::BStr, config::tree::keys};

    pub struct Workers;
    impl keys::Validate for Workers {
        fn validate(&self, value: &BStr) -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> {
            super::Checkout::WORKERS.try_from_workers(
                gix_config::Integer::try_from(value)
                    .and_then(|i| {
                        i.to_decimal()
                            .ok_or_else(|| gix_config::value::Error::new("Integer overflow", value.to_owned()))
                    })
                    .map(Some),
            )?;
            Ok(())
        }
    }
}

View on GitHub (pinned to e73179060b)