{"record":{"id":"ef6a28869e9a1e3e","repo":"zellij-org/zellij","slug":"unspecified-resizetype","errorCode":null,"errorMessage":"Unspecified ResizeType","messagePattern":"Unspecified ResizeType","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"zellij-utils/src/ipc/protobuf_conversion.rs","lineNumber":3491,"sourceCode":"        crate::data::UnblockCondition::OnExitSuccess => ProtoUnblockCondition::OnExitSuccess as i32,\n        crate::data::UnblockCondition::OnExitFailure => ProtoUnblockCondition::OnExitFailure as i32,\n        crate::data::UnblockCondition::OnAnyExit => ProtoUnblockCondition::OnAnyExit as i32,\n    }\n}\n\n// Reverse helper functions for Action conversion\n\nfn proto_i32_to_resize(resize: i32) -> Result<crate::data::Resize> {\n    use crate::client_server_contract::client_server_contract::ResizeType as ProtoResize;\n    let proto_resize = match resize {\n        x if x == ProtoResize::Increase as i32 => ProtoResize::Increase,\n        x if x == ProtoResize::Decrease as i32 => ProtoResize::Decrease,\n        _ => return Err(anyhow!(\"Invalid ResizeType: {}\", resize)),\n    };\n    match proto_resize {\n        ProtoResize::Increase => Ok(crate::data::Resize::Increase),\n        ProtoResize::Decrease => Ok(crate::data::Resize::Decrease),\n        ProtoResize::Unspecified => Err(anyhow!(\"Unspecified ResizeType\")),\n    }\n}\n\nfn proto_i32_to_direction(direction: i32) -> Result<crate::data::Direction> {\n    use crate::client_server_contract::client_server_contract::Direction as ProtoDirection;\n    let proto_direction = match direction {\n        x if x == ProtoDirection::Left as i32 => ProtoDirection::Left,\n        x if x == ProtoDirection::Right as i32 => ProtoDirection::Right,\n        x if x == ProtoDirection::Up as i32 => ProtoDirection::Up,\n        x if x == ProtoDirection::Down as i32 => ProtoDirection::Down,\n        _ => return Err(anyhow!(\"Invalid Direction: {}\", direction)),\n    };\n    match proto_direction {\n        ProtoDirection::Left => Ok(crate::data::Direction::Left),\n        ProtoDirection::Right => Ok(crate::data::Direction::Right),\n        ProtoDirection::Up => Ok(crate::data::Direction::Up),\n        ProtoDirection::Down => Ok(crate::data::Direction::Down),\n        ProtoDirection::Unspecified => Err(anyhow!(\"Unspecified direction\")),","sourceCodeStart":3473,"sourceCodeEnd":3509,"githubUrl":"https://github.com/zellij-org/zellij/blob/98a0837077492d53dd252ab30bc3e43e41e504f4/zellij-utils/src/ipc/protobuf_conversion.rs#L3473-L3509","documentation":"Intended to be returned by proto_i32_to_resize for ResizeType::Unspecified, but in the current code it is unreachable: the first match already routes any value other than Increase/Decrease (including Unspecified = 0) to 'Invalid ResizeType'. You will practically see 'Invalid ResizeType: 0' instead of this message.","triggerScenarios":"Only reachable if the first match were extended to accept Unspecified; today no input reaches this arm. The equivalent real-world trigger is an unset resize field, which produces error 122 with value 0.","commonSituations":"Grep-driven debugging where this string appears in search results but never in logs; contributors adding a variant to the first match without updating the second.","solutions":["When you see 'Invalid ResizeType: 0' in logs, treat it as an unset resize field and fix the sender","Merge the two matches into one so Unspecified is handled in a single place, eliminating the dead arm","Add a test covering all ResizeType values to keep the conversion exhaustive"],"exampleFix":"// before (two matches, dead Unspecified arm)\nlet proto_resize = match resize { ... _ => return Err(anyhow!(\"Invalid ResizeType: {}\", resize)) };\nmatch proto_resize { ..., ProtoResize::Unspecified => Err(anyhow!(\"Unspecified ResizeType\")) }\n\n// after (single exhaustive match)\nlet proto_resize = ProtoResize::try_from(resize).context(\"Invalid ResizeType\")?;","handlingStrategy":"validation","validationCode":"// Guard against the whole class (unset OR invalid) before converting:\nfn resize_field_ok(v: i32) -> bool {\n    v == ProtoResize::Increase as i32 || v == ProtoResize::Decrease as i32\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember Unspecified (0) is caught by 'Invalid ResizeType', not this arm, when reading logs","Consolidate multi-stage enum matches so dead arms cannot accumulate","Add exhaustive round-trip tests over all proto enum values"],"tags":["protobuf","dead-code","ipc","enum-decode"],"backgroundTag":null,"analyzedSha":"98a0837077492d53dd252ab30bc3e43e41e504f4","analyzedAt":"2026-08-16T13:02:01.396Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}