{"record":{"id":"1918888eb883e487","repo":"windmill-labs/windmill","slug":"error-parsing-permission-mode-value-s-e","errorCode":null,"errorMessage":"Error parsing permission mode value {s}: {e}","messagePattern":"Error parsing permission mode value (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-yaml/src/lib.rs","lineNumber":812,"sourceCode":"                    u.clone().try_into().map_err(|e| {\n                        anyhow!(\n                            \"Invalid value for `mode` permissions property on targeted file to: {}, err: {e}\",\n                            target_path\n                        )\n                    })?\n                }\n                Yaml::String(s) => {\n                    let val = if s.starts_with(\"0b\") {\n                        u32::from_str_radix(&s[2..], 2)\n                    } else if s.starts_with(\"0o\") {\n                        u32::from_str_radix(&s[2..], 8)\n                    } else if s.starts_with(\"0\") {\n                        u32::from_str_radix(&s[1..], 8)\n                    } else {\n                        u32::from_str_radix(s, 8)\n                    };\n\n                    val.map_err(|e| anyhow!(\"Error parsing permission mode value {s}: {e}\"))?\n                }\n                _ => {\n                    return Err(anyhow!(\"Invalid field in `mode`, expected integer like 0o644\"));\n                }\n            };\n            if mode_val <= 0o777 {\n                mode = Some(mode_val);\n            } else {\n                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`\"));\n            }\n        }\n\n        if let Some(Yaml::String(resource_path)) = f.get(&Yaml::String(\"resource\".to_string())) {\n            return Ok(FileResource {\n                resource_path: ResourceOrVariablePath::Resource(resource_path.clone()),\n                target_path,\n                mode,\n            });","sourceCodeStart":794,"sourceCodeEnd":830,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-yaml/src/lib.rs#L794-L830","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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`"],"exampleFix":"# before\n- resource: my_script\n  target: script.sh\n  mode: '0x644'\n\n# after\n- resource: my_script\n  target: script.sh\n  mode: '0o644'","handlingStrategy":"validation","validationCode":"fn validate_mode_str(s: &str) -> Result<u32, String> {\n    let digits = s.strip_prefix(\"0b\").map(|d| (d, 2))\n        .or_else(|| s.strip_prefix(\"0o\").map(|d| (d, 8)))\n        .or_else(|| s.strip_prefix('0').map(|d| (d, 8)))\n        .unwrap_or((s, 8));\n    let m = u32::from_str_radix(digits.0, digits.1).map_err(|e| format!(\"invalid mode string '{s}': {e}\"))?;\n    if m <= 0o777 { Ok(m) } else { Err(format!(\"mode '{s}' exceeds 0o777\")) }\n}","typeGuard":"fn is_valid_octal_mode(s: &str) -> bool {\n    let d = s.strip_prefix(\"0o\").or_else(|| s.strip_prefix('0')).unwrap_or(s);\n    !d.is_empty() && d.chars().all(|c| ('0'..='7').contains(&c))\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["yaml","ansible","file","permissions","parser"],"backgroundTag":"invalid-numeric-value","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}