Fix

"interface conversion: interface is nil, not X"

Fix the 'interface conversion: interface is nil' panic by checking if the interface is nil before performing a type assertion.

The panic "interface conversion: interface is nil, not X" occurs because you are performing a type assertion on a nil interface value, which is not the same as an interface holding a nil concrete value. You must check if the interface itself is nil before attempting the assertion, or use a two-value assertion to handle the failure gracefully.

var x interface{}
if x == nil {
    // Handle nil case
} else if v, ok := x.(YourType); ok {
    // Use v
} else {
    // Handle type mismatch
}