{"record":{"id":"f64c16b806631d40","repo":"zellij-org/zellij","slug":"unspecified-direction","errorCode":null,"errorMessage":"Unspecified direction","messagePattern":"Unspecified direction","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"zellij-utils/src/ipc/protobuf_conversion.rs","lineNumber":3509,"sourceCode":"        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\")),\n    }\n}\n\nfn proto_i32_to_search_direction(direction: i32) -> Result<crate::input::actions::SearchDirection> {\n    use crate::client_server_contract::client_server_contract::SearchDirection as ProtoSearchDirection;\n    let proto_direction = match direction {\n        x if x == ProtoSearchDirection::Up as i32 => ProtoSearchDirection::Up,\n        x if x == ProtoSearchDirection::Down as i32 => ProtoSearchDirection::Down,\n        _ => return Err(anyhow!(\"Invalid SearchDirection: {}\", direction)),\n    };\n    match proto_direction {\n        ProtoSearchDirection::Up => Ok(crate::input::actions::SearchDirection::Up),\n        ProtoSearchDirection::Down => Ok(crate::input::actions::SearchDirection::Down),\n        ProtoSearchDirection::Unspecified => Err(anyhow!(\"Unspecified search direction\")),\n    }\n}\n\nfn proto_i32_to_search_option(option: i32) -> Result<crate::input::actions::SearchOption> {","sourceCodeStart":3491,"sourceCodeEnd":3527,"githubUrl":"https://github.com/zellij-org/zellij/blob/98a0837077492d53dd252ab30bc3e43e41e504f4/zellij-utils/src/ipc/protobuf_conversion.rs#L3491-L3527","documentation":"Intended for Direction::Unspecified in proto_i32_to_direction, but unreachable in the current code: the first match routes Unspecified (0) to the 'Invalid Direction: 0' arm. The message exists only as a guard in the second match, which can only receive Left/Right/Up/Down.","triggerScenarios":"Not reachable through normal execution; the observable failure for an unset direction is 'Invalid Direction: 0' (error 124). Becomes reachable only if the first match is later widened to map 0 to Unspecified.","commonSituations":"Searching the codebase for this string during debugging; refactors that touch one match but not the other.","solutions":["Diagnose the real symptom as an unset/zero direction field on the sender","Consolidate the two-stage match into one exhaustive conversion so this cannot drift","Keep a unit test that round-trips every Direction value through the proto conversion"],"exampleFix":"// before\nmatch proto_direction { ..., ProtoDirection::Unspecified => Err(anyhow!(\"Unspecified direction\")) }\n\n// after\nmatch direction {\n    x if x == ProtoDirection::Left as i32 => Ok(crate::data::Direction::Left),\n    x if x == ProtoDirection::Right as i32 => Ok(crate::data::Direction::Right),\n    x if x == ProtoDirection::Up as i32 => Ok(crate::data::Direction::Up),\n    x if x == ProtoDirection::Down as i32 => Ok(crate::data::Direction::Down),\n    other => Err(anyhow!(\"Invalid or unspecified Direction: {}\", other)),\n}","handlingStrategy":"validation","validationCode":"// An unset direction shows up as 'Invalid Direction: 0'; guard before convert:\nfn direction_is_set_and_valid(v: i32) -> bool {\n    v != 0 && direction_value_is_valid(v)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When grepping logs, 'Unspecified direction' will not appear; look for 'Invalid Direction: 0' instead","Keep conversions single-stage and exhaustive to avoid dead branches","Test round-trips for every enum value crossing the wire"],"tags":["protobuf","dead-code","ipc","direction"],"backgroundTag":null,"analyzedSha":"98a0837077492d53dd252ab30bc3e43e41e504f4","analyzedAt":"2026-08-16T13:02:01.396Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}