gitbutlerapp/gitbutler · error
Unknown app suffix ' ', expected one of: dev, nightly…
Error message
Unknown app suffix '{value}', expected one of: dev, nightly, release What it means
AppChannel::from_str parses an app channel name/suffix into the AppChannel enum. It throws this error when the input string is not one of the recognized channel values ('nightly', 'release'/'production'/'prod', 'dev'/'development'). It exists to fail fast on unrecognized app suffixes rather than silently defaulting to a channel.
Solutions
- Use one of the accepted values: dev/development, nightly, or release/production/prod
- Normalize the input (trim and lowercase) before parsing
- Handle the parse failure with a fallback to a default channel, e.g. unwrap_or(AppChannel::Release)
Example fix
// before let channel = value.parse::<AppChannel>()?; // value = "Beta" // after let channel = value.trim().to_lowercase().parse::<AppChannel>().unwrap_or(AppChannel::Release);
Defensive patterns
Strategy: validation
Validate before calling
fn is_valid_channel(v: &str) -> bool {
matches!(v.trim().to_lowercase().as_str(), "dev" | "development" | "nightly" | "release" | "production" | "prod")
} Type guard
fn valid_channel(s: &str) -> Option<AppChannel> {
AppChannel::from_str(&s.trim().to_lowercase()).ok()
} Try / catch
let channel = value.parse::<AppChannel>()
.map_err(|e| format!("invalid channel '{value}': {e}"))?; Prevention
- Trim and lowercase channel strings before parsing
- Keep channel names centralized in constants/enum parsing, never free-form strings
- Fall back to a documented default channel and log a warning
When it happens
Trigger: Calling AppChannel::from_str (or .parse::<AppChannel>()) with any string other than the accepted aliases, e.g. 'beta', 'stable', 'main', 'Dev ' with whitespace, or mixed case like 'Nightly'.
Common situations: Config files or CLI flags specifying a channel with a typo, an outdated channel name that was removed, or a value that uses different casing/spacing than expected.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Expected `project_id` to be either a ProjectHandle or a…
- Unknown reaction kind
- commit prefix ' ' is ambiguous
- commit ' ' is not part of the editable divergence
- Could not find range from
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/724ba35d45eaea62.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-path/src/lib.rs:348
new_window: bool,
) -> anyhow::Result<url::Url> {
let mut url = url::Url::parse(&format!("{scheme}://open"))?;
url.query_pairs_mut()
.append_pair("path", &possibly_project_dir.to_string_lossy())
.append_pair("t", ×tamp.to_string())
.append_pair("new_window", if new_window { "1" } else { "0" });
Ok(url)
}
impl std::str::FromStr for AppChannel {
type Err = anyhow::Error;
fn from_str(value: &str) -> Result<Self, Self::Err> {
match value {
"nightly" => Ok(AppChannel::Nightly),
"release" | "production" | "prod" => Ok(AppChannel::Release),
"dev" | "development" => Ok(AppChannel::Dev),
_ => Err(anyhow::anyhow!(
"Unknown app suffix '{value}', expected one of: dev, nightly, release"
)),
}
}
}
fn clean_env_vars<'a, 'b>(
var_names: &'a [&'b str],
) -> impl Iterator<Item = (&'b str, String)> + 'a {
var_names
.iter()
.filter_map(|name| env::var(name).map(|value| (*name, value)).ok())
.map(|(name, value)| {
(
name,
value
.split(':')
.filter(|path| !path.contains("appimage-run") && !path.contains("/tmp/.mount"))View on GitHub (pinned to 58e5313667)