windmill-labs/windmill · error
Error parsing permission mode value {s}: {e}
Error message
Error parsing permission mode value {s}: {e} What it means
parse_file_resource throws this when the `mode` key of a file entry is a YAML string that cannot be parsed as an octal (or binary with 0b prefix) number. The parser accepts strings like '0o644', '0644', or '644' and parses them with u32::from_str_radix; any radix-parse failure (invalid digits, empty string, oversized value) is wrapped in this error showing the offending string.
Source
Thrown at backend/parsers/windmill-parser-yaml/src/lib.rs:812
u.clone().try_into().map_err(|e| {
anyhow!(
"Invalid value for `mode` permissions property on targeted file to: {}, err: {e}",
target_path
)
})?
}
Yaml::String(s) => {
let val = if s.starts_with("0b") {
u32::from_str_radix(&s[2..], 2)
} else if s.starts_with("0o") {
u32::from_str_radix(&s[2..], 8)
} else if s.starts_with("0") {
u32::from_str_radix(&s[1..], 8)
} else {
u32::from_str_radix(s, 8)
};
val.map_err(|e| anyhow!("Error parsing permission mode value {s}: {e}"))?
}
_ => {
return Err(anyhow!("Invalid field in `mode`, expected integer like 0o644"));
}
};
if mode_val <= 0o777 {
mode = Some(mode_val);
} else {
return Err(anyhow!("The provided value for `mode` is too big. Make sure that you are using the octal prefix (0o), e.g. `mode: 0o644`"));
}
}
if let Some(Yaml::String(resource_path)) = f.get(&Yaml::String("resource".to_string())) {
return Ok(FileResource {
resource_path: ResourceOrVariablePath::Resource(resource_path.clone()),
target_path,
mode,
});View on GitHub (pinned to e474e8803c)
Solutions
- Use a valid octal string: '0o644', '0644', or '644' (digits 0-7 only)
- Remove unsupported prefixes like 0x; use 0b only for binary
- Ensure the string is non-empty and contains no separators or stray characters
- Alternatively pass mode as a YAML integer with the 0o octal literal: `mode: 0o644`
Example fix
# before - resource: my_script target: script.sh mode: '0x644' # after - resource: my_script target: script.sh mode: '0o644'
Defensive patterns
Strategy: validation
Validate before calling
fn validate_mode_str(s: &str) -> Result<u32, String> {
let digits = s.strip_prefix("0b").map(|d| (d, 2))
.or_else(|| s.strip_prefix("0o").map(|d| (d, 8)))
.or_else(|| s.strip_prefix('0').map(|d| (d, 8)))
.unwrap_or((s, 8));
let m = u32::from_str_radix(digits.0, digits.1).map_err(|e| format!("invalid mode string '{s}': {e}"))?;
if m <= 0o777 { Ok(m) } else { Err(format!("mode '{s}' exceeds 0o777")) }
} Type guard
fn is_valid_octal_mode(s: &str) -> bool {
let d = s.strip_prefix("0o").or_else(|| s.strip_prefix('0')).unwrap_or(s);
!d.is_empty() && d.chars().all(|c| ('0'..='7').contains(&c))
} Prevention
- Use '0o644' style strings (or plain octal digits 0-7)
- Avoid hex (0x) — only 0b/0o/leading-0/plain octal are supported
- Keep the value <= 0o777 to avoid the 'too big' error
When it happens
Trigger: A file entry's `mode` is a Yaml::String containing non-octal digits (e.g. 'abc', '648', '0x644'), an empty string, or a value whose parse overflows u32.
Common situations: Using hex prefix 0x (unsupported — only 0b/0o/leading-0/plain octal); including characters like commas or underscores; decimal digits >= 8 such as '648' inside an octal string; an empty quoted string.
Related errors
- Invalid value for `mode` permissions property on targeted fi
- No `target` provided for the file. Please input a target pat
- git_repos field expects an array of repos
- Failed to parse git repo: {e}
- git_ssh_identity expects an array of windmill variables (or
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/1918888eb883e487.
Report an issue: GitHub.