# Assertion 'field' failed.

**URL:** <https://community.zeek.org/t/assertion-field-failed/3600>\
**Category:** Zeek\
**Created:** [May 18, 2015, 12:24pm UTC](https://community.zeek.org/t/assertion-field-failed/3600 "2015-05-18T12:24:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abdelkarim\_benkhadra](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@Abdelkarim\_benkhadra](https://community.zeek.org/u/Abdelkarim_benkhadra)\
**Post date:** [May 18, 2015, 12:24pm UTC](https://community.zeek.org/t/assertion-field-failed/3600/1 "2015-05-18T12:24:45Z")

</div>

Hi,

i’m writing an analyzer for a protocol, i wrote all files needed and when 'make’ing bro i get an error of:  
binpac: …/bro-2.4-beta/aux/binpac/src/pac\_expr.cc:225: RecordField\* {anonymous}::GetRecordField(const ID\*, Env\*): Assertion ‘field’ failed.  
i assume the error comes from .pac files so what could possibly generate this kind of error?

regards,

---

<div class="post-metadata">

**Author:** ![Vlad\_Grigorescu1](https://avatars.discourse-cdn.com/v4/letter/v/f9ae1b/32.png) [@Vlad\_Grigorescu1](https://community.zeek.org/u/Vlad_Grigorescu1)\
**Post date:** [May 18, 2015, 12:51pm UTC](https://community.zeek.org/t/assertion-field-failed/3600/2 "2015-05-18T12:51:37Z")

</div>

Hi,

That's a rather vague error, unfortunately. You can try using gdb to  
debug and pinpoint which record and field this is referring to. Do you  
have the code available for review somewhere, or could you share the  
snippet that you suspect is the issue?

&nbsp;&nbsp;--Vlad

---

<div class="post-metadata">

**Author:** ![Abdelkarim\_benkhadra](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@Abdelkarim\_benkhadra](https://community.zeek.org/u/Abdelkarim_benkhadra)\
**Post date:** [May 18, 2015, 1:37pm UTC](https://community.zeek.org/t/assertion-field-failed/3600/3 "2015-05-18T13:37:55Z")

</div>

i think i found the responsible,

i have a record :

type myrec = record {

//some fields.  
last\_field: bytestring &restofdata;  
} &length = sizeof(this);

with this length specification i get the RecordField\* error and when trying &length=20+sizeof(last\_field) i get “cannot determine initial buffer length for type myrec” and without &length it passes.  
so far im not going to specify the &length value and let you know if something comes up.

thanks,

---

<div class="post-metadata">

**Author:** ![Vlad\_Grigorescu1](https://avatars.discourse-cdn.com/v4/letter/v/f9ae1b/32.png) [@Vlad\_Grigorescu1](https://community.zeek.org/u/Vlad_Grigorescu1)\
**Post date:** [May 18, 2015, 2:56pm UTC](https://community.zeek.org/t/assertion-field-failed/3600/4 "2015-05-18T14:56:39Z")

</div>

Yeah, that &length looks suspicious to me. &length=sizeof(this) is  
essentially saying "set the length of the record to the size of the  
record."

I'd try it without the length specified at all, like you said.

You might want to review this section of the documentation:  
[https://www.bro.org/sphinx/components/binpac/README.html#buffering](https://www.bro.org/sphinx/components/binpac/README.html#buffering)

&nbsp;&nbsp;--Vlad

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/zeek/original/1X/f09d732bc2cc7c7cc7e35db67cf4e1d5233ce7a7.png) [@system](https://community.zeek.org/u/system)\
**Post date:** [May 6, 2022, 3:42pm UTC](https://community.zeek.org/t/assertion-field-failed/3600/5 "2022-05-06T15:42:40Z")

</div>


