gitbutlerapp/gitbutler · error
configured storage path
Error message
configured storage path '{}' resolves inside '.git' but not under a top-level 'gitbutler*' directory What it means
GitButler reserves a top-level 'gitbutler*' directory inside .git for its storage. This error fires when a configured storage path resolves inside .git but under some other top-level directory, which could conflict with Git internals or other tools.
Solutions
- Rename the configured storage path so its first component starts with 'gitbutler' (e.g. .git/gitbutler/storage)
- If external storage is needed, configure a path outside .git entirely
- Re-run resolution after fixing the config to confirm validation passes
Example fix
// before (.gitconfig) [gitbutler] storagePath = refs/gbdata // after [gitbutler] storagePath = gitbutler/gbdata
Defensive patterns
Strategy: validation
Validate before calling
let rel = storage_path.strip_prefix(git_dir)?;
let ok = rel.components().next()
.map(|c| c.as_os_str().to_string_lossy().to_lowercase().starts_with("gitbutler"))
.unwrap_or(false);
anyhow::ensure!(ok, "storage path inside .git must start with a 'gitbutler*' directory"); Type guard
fn is_gitbutler_dir(p: &std::path::Path) -> bool {
p.components().next()
.map(|c| c.as_os_str().to_string_lossy().to_lowercase().starts_with("gitbutler"))
.unwrap_or(false)
} Try / catch
match resolve_configured_storage_path(&repo) {
Ok(p) => p,
Err(e) if e.to_string().contains("gitbutler*") => {
eprintln!("rename configured storage dir to a gitbutler* prefix");
return Err(e);
}
Err(e) => return Err(e),
} Prevention
- Follow the gitbutler* naming convention for in-.git storage
- Keep storage outside .git when custom locations are needed
- Lint generated configs for the reserved prefix
When it happens
Trigger: Calling `resolve_configured_storage_path` with a config value whose path, relative to the git dir, starts with a top-level component not prefixed with 'gitbutler' (case-insensitive), e.g. '.git/refs/storage' or '.git/mydata'.
Common situations: Hand-editing .gitconfig and choosing an arbitrary subdirectory; scripts that compute a storage location without the naming convention; copy-pasting a path from another tool.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- configured storage path
- DefaultTargetNotFound
- Failed to find remote branch's corresponding remote
- Local AI configuration requires running inside a git…
- No base branch configured
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/985222843a9ef763.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-project-handle/src/storage_path.rs:102
fn validate_in_git_storage_path(
storage_path_relative_to_git_dir: &Path,
storage_path: &Path,
) -> anyhow::Result<()> {
let Some(Component::Normal(top_level_dir)) =
storage_path_relative_to_git_dir.components().next()
else {
bail!(
"configured storage path '{}' resolves to '.git' itself; choose a dedicated GitButler directory instead",
storage_path.display()
);
};
if !top_level_dir
.to_string_lossy()
.get(..DEFAULT_STORAGE_DIR_NAME.len())
.is_some_and(|name| name.eq_ignore_ascii_case(DEFAULT_STORAGE_DIR_NAME))
{
bail!(
"configured storage path '{}' resolves inside '.git' but not under a top-level 'gitbutler*' directory",
storage_path.display()
);
}
Ok(())
}
/// Name of the default GitButler storage directory inside the git dir.
pub const DEFAULT_STORAGE_DIR_NAME: &str = "gitbutler";
/// Git-dir-relative path of the refresh sentinel, `gitbutler/REFRESH`.
///
/// Single source of truth shared by the writer (`write_refresh_sentinel`) and
/// the watcher (`gitbutler_filemonitor`).
pub const REFRESH_SENTINEL_PATH: &str = "gitbutler/REFRESH";
/// Identity written into the refresh sentinel so a process can skip the writeView on GitHub (pinned to 58e5313667)