I have an item file (produced the same way as all the others we’re using this quarter in 567) that gives this error whenever we process it with [incr tsdb()]
read_tuple(): arity mismatch (16 vs. 15) for ‘item’ (300)
Does anyone have any advice on how to chase this down? Also, is (300) an error code, or an i-id or something else?
I’ve looked at the source code for the tsdb program, and it looks to me as though the text in parentheses – 300 in this case – is taken from the item file and is where the program thinks the problem is.
The regular expression expects an empty first field (i.e., the line starts with @), which is not true of item files because the first field is the required i-id. Also, as Emily hinted at, since the @ delimits fields, there would be 15 when the line seems to have 16 fields. This might work better:
grep -nE "[^@]*(@[^@]*){15}$" item
You can also use awk to print the line numbers of records without the expected number of fields:
awk -F'@' '{ if(NF != 15) print NR }' item
See the sections about formatting/escaping in the ItsdbReference wiki or the delphin.tsdb module documentation. E.g., from the latter:
The characters and their escape sequences are:
@ -> \s
(newline) -> \n
\ -> \\
Every literal @ in TSDB files needs to be escaped. Sometimes they sneak in when files are manually edited or created using tools unaware of the formatting conventions. Woodley’s mkprof, PyDelphin’s delphin mkprof, and of course [incr tsdb()] will escape things correctly.
I suspect this error was coming in in the AGG processing pipeline (taking IGT from e.g. Toolbox, making Xigt, and then item files.) I’ll make a note on our end.