zeek/spicy

Obscure `UnsetOptional` error on `assert` from `%done` hook

Closed this issue · 0 comments

I came across the following failure:

module foo;

public type X = unit {
    on %done { assert self.offset() != 0; }
};

The assertion always fails since the unit consumes no input. With that I see

$ echo | spicy-driver -d foo.spicy
[error] terminating with uncaught exception of type hilti::rt::UnsetOptional: unset optional value (foo.spicy:4:16)

Interestingly this seems to tied to the use of assert, if I e.g., print the boolean expression this shows the expected False.