{"record":{"id":"b0d232e44b431a5b","repo":"windmill-labs/windmill","slug":"invalid-field-in-mode-expected-integer-like-0o6","errorCode":null,"errorMessage":"Invalid field in `mode`, expected integer like 0o644","messagePattern":"Invalid field in `mode`, expected integer like 0o644","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-yaml/src/lib.rs","lineNumber":815,"sourceCode":"                            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            });\n        }\n        if let Some(Yaml::String(resource_path)) = f.get(&Yaml::String(\"variable\".to_string())) {\n            return Ok(FileResource {","sourceCodeStart":797,"sourceCodeEnd":833,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-yaml/src/lib.rs#L797-L833","documentation":"Windmill's YAML parser parses file resources for Ansible-style file deployments. The optional `mode` field controls Unix file permissions and must be either a YAML integer or a string parseable as an octal/binary number (e.g. \"0o644\"). This error is thrown in parse_file_resource when the `mode` key is present but its value is neither a Yaml::Integer nor a Yaml::String — e.g. a boolean, null, sequence, or map.","triggerScenarios":"Calling parse_file_resource (via YAML file-resource parsing during script/app deploy) with an entry like `mode: [644]`, `mode: true`, `mode: null`, or a nested map under `mode`. Any non-scalar, non-string, non-integer value hits the `_` catch-all match arm.","commonSituations":"Quoting mistakes that turn `mode: 0644` into something YAML type-infers as boolean (e.g. `mode: no` / `mode: on` become Yaml::Boolean); copy-pasting a JSON array or object into the mode field; editors that autoformat `0o644` into a list; leaving `mode:` with no value (Yaml::Null).","solutions":["Set `mode` to a YAML integer (e.g. `mode: 420` for 0o644) or a quoted octal string (e.g. `mode: \"0o644\"`).","Remove any surrounding brackets/braces so the value is a scalar, not a list or map.","If you intended 'off'/'on', quote it or use a numeric mode instead — YAML booleans are rejected here.","Ensure the `mode` key has a value on the same line; an empty key parses as null and fails."],"exampleFix":"# before\nfiles:\n  - target: /etc/app.conf\n    mode:\n      perms: 644\n# after\nfiles:\n  - target: /etc/app.conf\n    mode: \"0o644\"","handlingStrategy":"validation","validationCode":"fn validate_mode(v: &serde_yaml::Value) -> Result<(), String> {\n    match v.get(\"mode\") {\n        None => Ok(()),\n        Some(serde_yaml::Value::Number(n)) if n.as_u64().map(|x| x <= 0o777).unwrap_or(false) => Ok(()),\n        Some(serde_yaml::Value::String(s)) if s.starts_with(\"0o\") || s.starts_with(\"0b\") || s.starts_with(\"0\") => Ok(()),\n        Some(other) => Err(format!(\"mode must be an int or octal string, got: {other:?}\")),\n    }\n}","typeGuard":"fn is_valid_mode(v: &serde_yaml::Value) -> bool {\n    matches!(v, serde_yaml::Value::Number(_) | serde_yaml::Value::String(_))\n}","tryCatchPattern":"match parse_and_deploy(yaml) {\n    Err(e) if e.to_string().contains(\"Invalid field in `mode`\") => {\n        eprintln!(\"Fix `mode` to an integer or octal string like \\\"0o644\\\"\\n{e}\");\n    }\n    Err(e) => return Err(e),\n    Ok(v) => Ok(v),\n}","preventionTips":["Always write modes as quoted octal strings: mode: \"0o644\"","Never leave `mode:` empty — YAML infers null","Run yamllint before deploying YAML with file resources","Check that mode is a scalar, not a list or map"],"tags":["yaml","validation","file-resource","ansible"],"backgroundTag":"invalid-yaml-field-type","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"}