zellij-org/zellij · error · anyhow::Error
Invalid ResizeType: {}
Error message
Invalid ResizeType: {} What it means
Returned by the reverse-conversion helper proto_i32_to_resize when the incoming i32 matches neither ResizeType::Increase nor ResizeType::Decrease. Note that Unspecified (=0) is also caught here, so this error fires both for garbage values and for unset fields.
Source
Thrown at zellij-utils/src/ipc/protobuf_conversion.rs:3486
}
fn unblock_condition_to_proto_i32(condition: crate::data::UnblockCondition) -> i32 {
use crate::client_server_contract::client_server_contract::UnblockCondition as ProtoUnblockCondition;
match condition {
crate::data::UnblockCondition::OnExitSuccess => ProtoUnblockCondition::OnExitSuccess as i32,
crate::data::UnblockCondition::OnExitFailure => ProtoUnblockCondition::OnExitFailure as i32,
crate::data::UnblockCondition::OnAnyExit => ProtoUnblockCondition::OnAnyExit as i32,
}
}
// Reverse helper functions for Action conversion
fn proto_i32_to_resize(resize: i32) -> Result<crate::data::Resize> {
use crate::client_server_contract::client_server_contract::ResizeType as ProtoResize;
let proto_resize = match resize {
x if x == ProtoResize::Increase as i32 => ProtoResize::Increase,
x if x == ProtoResize::Decrease as i32 => ProtoResize::Decrease,
_ => return Err(anyhow!("Invalid ResizeType: {}", resize)),
};
match proto_resize {
ProtoResize::Increase => Ok(crate::data::Resize::Increase),
ProtoResize::Decrease => Ok(crate::data::Resize::Decrease),
ProtoResize::Unspecified => Err(anyhow!("Unspecified ResizeType")),
}
}
fn proto_i32_to_direction(direction: i32) -> Result<crate::data::Direction> {
use crate::client_server_contract::client_server_contract::Direction as ProtoDirection;
let proto_direction = match direction {
x if x == ProtoDirection::Left as i32 => ProtoDirection::Left,
x if x == ProtoDirection::Right as i32 => ProtoDirection::Right,
x if x == ProtoDirection::Up as i32 => ProtoDirection::Up,
x if x == ProtoDirection::Down as i32 => ProtoDirection::Down,
_ => return Err(anyhow!("Invalid Direction: {}", direction)),
};
match proto_direction {View on GitHub (pinned to 98a0837077)
Solutions
- Ensure the sender always sets resize explicitly when serializing a Resize action
- Use matching zellij versions on both ends of the IPC connection
- Validate the i32 is one of Increase/Decrease before invoking the conversion
Example fix
// before
let resize = proto_i32_to_resize(action.resize)?;
// after
let resize = proto_i32_to_resize(action.resize)
.unwrap_or(crate::data::Resize::Increase); // or surface a typed error upstream Defensive patterns
Strategy: validation
Validate before calling
use crate::client_server_contract::client_server_contract::ResizeType as ProtoResize;
fn resize_value_is_valid(v: i32) -> bool {
v == ProtoResize::Increase as i32 || v == ProtoResize::Decrease as i32
} Type guard
fn is_valid_resize(v: i32) -> bool {
v == ProtoResize::Increase as i32 || v == ProtoResize::Decrease as i32
} Try / catch
let resize = proto_i32_to_resize(action.resize)
.map_err(|e| e.context("action.resize missing or out of range — sender likely omitted the field"))?; Prevention
- Always set enum fields on the sender, even when a default seems obvious
- Keep both ends of the IPC on one build; deploy client and server together
- Treat value 0 in logs as 'field never set' and fix the producer, not the consumer
When it happens
Trigger: Converting an Action's resize field where the sender left the proto enum unset (proto3 default 0 = Unspecified) or sent an out-of-range integer, e.g. a Resize action decoded from a mismatched or malformed protobuf message.
Common situations: Version skew between client and server after the resize enum changed; payloads built by external tooling that omits the resize field entirely.
Related errors
- ResizeByPaneId missing resize_action
- ResizeByPaneId missing pane_id
- Invalid InputMode value: {}
- Unspecified ResizeType
- Invalid Direction: {}
AI-assisted analysis of zellij-org/zellij@98a0837077 (2026-08-16).
Data as JSON: /api/errors/2864425cba9b518e.
Report an issue: GitHub.