{"record":{"id":"8caa34563ce325e6","repo":"windmill-labs/windmill","slug":"invalid-value-for-mode-permissions-property-on-t","errorCode":null,"errorMessage":"Invalid value for `mode` permissions property on targeted file to: {}, err: {e}","messagePattern":"Invalid value for `mode` permissions property on targeted file to: (.+?), err: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-yaml/src/lib.rs","lineNumber":795,"sourceCode":"    max_count\n}\n\nfn parse_file_resource(yaml: &Yaml) -> anyhow::Result<FileResource> {\n    if let Yaml::Hash(f) = yaml {\n        let target_path = f\n            .get(&Yaml::String(\"target\".to_string()))\n            .and_then(|x| x.as_str())\n            .map(|x| x.to_string())\n            .ok_or(anyhow!(\n                \"No `target` provided for the file. Please input a target path (only relative paths are allowed) where the ansible playbook can read this file.\",\n            ))?;\n\n        let mut mode = None;\n        if let Some(u) = f.get(&Yaml::String(\"mode\".to_string())) {\n            let mode_val: u32 = match u {\n                Yaml::Integer(u) => {\n                    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                }","sourceCodeStart":777,"sourceCodeEnd":813,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-yaml/src/lib.rs#L777-L813","documentation":"parse_file_resource throws this when the `mode` key of a file entry is a YAML integer that cannot fit into u32 (e.g. a negative number or an out-of-range i64 value). The integer branch does `i64 -> u32` conversion and wraps any failure with this message, which includes the file's target path and the underlying conversion error.","triggerScenarios":"A file entry has `mode` as Yaml::Integer whose value is negative or exceeds u32::MAX (e.g. `mode: -1` or an absurdly large number), so `try_into::<u32>()` fails.","commonSituations":"Writing a negative mode by sign typo; pasting a decimal that overflows; confusing octal notation and entering an enormous value; YAML parsing an unquoted large literal as i64.","solutions":["Use a valid permission value within 0o0..0o777 (e.g. `mode: 0o644`)","Remove any negative sign from the mode value","If writing decimal, keep it <= 511 (the decimal equivalent of 0o777)","Quote octal strings with the 0o prefix as an alternative (`mode: '0o644'`)"],"exampleFix":"# before\n- resource: my_script\n  target: script.sh\n  mode: -644\n\n# after\n- resource: my_script\n  target: script.sh\n  mode: 0o644","handlingStrategy":"validation","validationCode":"fn validate_mode_int(mode: i64) -> Result<u32, String> {\n    let m = u32::try_from(mode).map_err(|_| format!(\"mode {} is negative or overflows u32\", mode))?;\n    if m <= 0o777 { Ok(m) } else { Err(format!(\"mode {m} exceeds 0o777; use an octal literal like 0o644\")) }\n}","typeGuard":"fn is_valid_mode(v: &Yaml) -> bool {\n    match v {\n        Yaml::Integer(i) => *i >= 0 && *i <= 0o777,\n        Yaml::String(s) => u32::from_str_radix(s.trim_start_matches(\"0o\").trim_start_matches(\"0\"), 8).map(|m| m <= 0o777).unwrap_or(false),\n        _ => false,\n    }\n}","tryCatchPattern":null,"preventionTips":["Write mode as an octal literal: `mode: 0o644`","Never use negative values for mode","Keep integer modes within 0..0o777 (0..511 decimal)"],"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"}