{"record":{"id":"9e1f69d86e30d375","repo":"sxyazi/yazi","slug":"at-least-one-layout-ratio-must-be-non-zero","errorCode":null,"errorMessage":"at least one layout ratio must be non-zero: {:?}","messagePattern":"at least one layout ratio must be non-zero: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"yazi-config/src/mgr/ratio.rs","lineNumber":18,"sourceCode":"use anyhow::bail;\nuse mlua::{ExternalError, FromLua, IntoLua, Lua, Table, Value};\nuse serde::{Deserialize, Serialize};\n\n#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]\n#[serde(try_from = \"[u16; 3]\")]\npub struct MgrRatio {\n\tparent:  u16,\n\tcurrent: u16,\n\tpreview: u16,\n}\n\nimpl TryFrom<[u16; 3]> for MgrRatio {\n\ttype Error = anyhow::Error;\n\n\tfn try_from(ratio: [u16; 3]) -> Result<Self, Self::Error> {\n\t\tif ratio.iter().all(|&r| r == 0) {\n\t\t\tbail!(\"at least one layout ratio must be non-zero: {:?}\", ratio);\n\t\t}\n\n\t\tOk(Self { parent: ratio[0], current: ratio[1], preview: ratio[2] })\n\t}\n}\n\nimpl TryFrom<Table> for MgrRatio {\n\ttype Error = mlua::Error;\n\n\tfn try_from(t: Table) -> Result<Self, Self::Error> {\n\t\tOk([t.raw_get(1)?, t.raw_get(2)?, t.raw_get(3)?].try_into()?)\n\t}\n}\n\nimpl FromLua for MgrRatio {\n\tfn from_lua(value: Value, _: &Lua) -> mlua::Result<Self> {\n\t\tmatch value {\n\t\t\tValue::Table(t) => t.try_into(),","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/sxyazi/yazi/blob/8ebf930f1796ae2076b7d6b0c5e93a1002c18134/yazi-config/src/mgr/ratio.rs#L1-L36","documentation":"A serde validation guard (TryFrom<[u16; 3]> for MgrRatio) that runs when the `[mgr] ratio` option is deserialized from yazi.toml. It fires when all three layout ratios (parent/current/preview) are 0, which would make column-width division impossible. The input at fault is the user's ratio array, e.g. `ratio = [0, 0, 0]`; at least one value must be a positive integer.","triggerScenarios":"Thrown at yazi-config/src/mgr/ratio.rs:23 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set at least one of the three `[mgr] ratio` entries to a positive number.","Prefer the documented default `[1, 2, 3]` rather than all zeros."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8ebf930f1796ae2076b7d6b0c5e93a1002c18134","analyzedAt":"2026-09-09T22:26:16.379Z","contentChangedAt":"2026-09-09T22:26:16.379Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}