{"record":{"id":"81f6479937cfd285","repo":"wasmerio/wasmer","slug":"unhandled-inner-case","errorCode":null,"errorMessage":"Unhandled inner case","messagePattern":"Unhandled inner case","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/compiler-llvm/src/translator/code.rs","lineNumber":8771,"sourceCode":"                );\n                let res = err!(\n                    self.builder\n                        .build_bit_cast(res, self.intrinsics.i128_ty, \"\")\n                );\n                self.state.push1(res);\n            }\n            Operator::I64x2ExtendLowI32x4U\n            | Operator::I64x2ExtendLowI32x4S\n            | Operator::I64x2ExtendHighI32x4U\n            | Operator::I64x2ExtendHighI32x4S => {\n                let extend = match op {\n                    Operator::I64x2ExtendLowI32x4U | Operator::I64x2ExtendHighI32x4U => {\n                        |s: &Self, v| s.builder.build_int_z_extend(v, s.intrinsics.i64x2_ty, \"\")\n                    }\n                    Operator::I64x2ExtendLowI32x4S | Operator::I64x2ExtendHighI32x4S => {\n                        |s: &Self, v| s.builder.build_int_s_extend(v, s.intrinsics.i64x2_ty, \"\")\n                    }\n                    _ => unreachable!(\"Unhandled inner case\"),\n                };\n                let indices = match op {\n                    Operator::I64x2ExtendLowI32x4S | Operator::I64x2ExtendLowI32x4U => {\n                        [self.intrinsics.i32_consts[0], self.intrinsics.i32_consts[1]]\n                    }\n                    Operator::I64x2ExtendHighI32x4S | Operator::I64x2ExtendHighI32x4U => {\n                        [self.intrinsics.i32_consts[2], self.intrinsics.i32_consts[3]]\n                    }\n                    _ => unreachable!(\"Unhandled inner case\"),\n                };\n                let (v, i) = self.state.pop1_extra()?;\n                let (v, _) = self.v128_into_i32x4(v, i)?;\n                let low = err!(self.builder.build_shuffle_vector(\n                    v,\n                    v.get_type().get_undef(),\n                    VectorType::const_vector(&indices),\n                    \"\",\n                ));","sourceCodeStart":8753,"sourceCodeEnd":8789,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/compiler-llvm/src/translator/code.rs#L8753-L8789","documentation":"An explicit `unreachable!(\"Unhandled inner case\")` panic inside `translate_conversion_operator` in wasmer's LLVM backend. For the SIMD `I64x2Extend*I32x4*` conversion operators the code builds a nested match to pick the extend closure (zero- vs sign-extend); if the outer match dispatched an operator the inner match does not enumerate, the inner wildcard at code.rs:8771 panics. This indicates an inconsistency between the outer operator dispatch and the inner operator refinement — reached only when a conversion operator's inner selection was not covered, usually due to a bug or a non-standard/new operator variant.","triggerScenarios":"Compiling a Wasm module whose conversion operator (in this arm: I64x2ExtendLow/HighI32x4S/U family, or a neighboring SIMD conversion like f32x4/f64x2 converts) reaches translate_conversion_operator but falls into the inner `_` arm via `Module::new` with the LLVM backend.","commonSituations":"Newer toolchains emitting SIMD conversion or relaxed-simd conversion instructions unsupported by the installed wasmer version; LLVM backend selected for SIMD modules; hand-modified or fuzzed bytecode bypassing validation.","solutions":["Use the Cranelift backend for this module instead of LLVM","Upgrade wasmer and wasmer-compiler-llvm to a version covering the conversion operator","Recompile the module without the offending SIMD conversion instructions (disable simd128/relaxed-simd)","Validate the module with restrictive feature flags before compilation so this becomes a proper compile error","If the operator is standard and present in upstream wasmer, file a bug with the module and wasmer version"],"exampleFix":"// before\nlet engine = Engine::from(LLVM::new());\n// after\nlet engine = Engine::from(Cranelift::new());","handlingStrategy":"try-catch","validationCode":"fn validate_before_compile(engine: &wasmer::Engine, wasm: &[u8]) -> Result<(), String> {\n    wasmer::Module::validate(engine, wasm)\n        .map_err(|e| format!(\"unsupported conversion op (SIMD extend?): {e}\"))\n}","typeGuard":"fn has_simd_conversion_ops(wasm: &[u8]) -> bool {\n    // SIMD conversions use the 0xFD prefix opcode space\n    wasm.windows(2).any(|w| w[0] == 0xFD)\n}","tryCatchPattern":"let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {\n    wasmer::Module::new(&llvm_engine, &wasm)\n}));\nmatch result {\n    Ok(Ok(module)) => Ok(module),\n    Ok(Err(e)) => Err(e.into()),\n    Err(_) => {\n        log::warn(\"wasmer LLVM panic (unhandled conversion case); retrying with Cranelift\");\n        wasmer::Module::new(&cranelift_engine, &wasm).map_err(Into::into)\n    }\n}","preventionTips":["Validate modules with SIMD features off unless your wasmer+LLVM build supports them fully","Run compilation in an isolated thread and translate panics into CompileError-like results","Keep a Cranelift fallback engine for modules the LLVM backend cannot compile","Upgrade wasmer when your wasm toolchain starts emitting newer SIMD conversion opcodes","Add CI coverage compiling your real wasm artifacts with the exact production engine config"],"tags":["rust","wasm","llvm","simd","conversion","panic"],"backgroundTag":"compiler-unreachable-panic","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}