-
Notifications
You must be signed in to change notification settings - Fork 13
Description
rdump returns a fatal error even when target-query returns 0 records without any errors. To me this seems incorrect because if there are 0 records to be parsed this should for example generate a warning or at least a different type of error. Not sure what is the best approach here but happy to submit a pull request with some feedback on how the team thinks this should be handled.
Example output with error:
target-query -f firewall.logs ../cache/Collection-workstation-03 | rdump -vvvv -w "jsonfile://test.json"
2026-01-18T06:47:57.776788Z [debug ] Creating <class 'flow.record.adapter.jsonfile.JsonfileWriter'> for 'jsonfile://test.json' with args {'clobber': True} [flow.record.base]
2026-01-18T06:47:57.780143Z [debug ] Record stream with selector: None [flow.record.stream]
[reading from stdin]
2026-01-18T06:47:58.658826Z [error ] rdump encountered a fatal error: Could not find adapter for file-like object [flow.record.tools.rdump]
2026-01-18T06:47:58.658906Z [error ] Full traceback [flow.record.tools.rdump]
Traceback (most recent call last):
File "/opt/homebrew/Caskroom/miniforge/base/envs/dissect/lib/python3.12/site-packages/flow/record/tools/rdump.py", line 397, in main
for count, rec in enumerate(record_iterator, start=1): # noqa: B007
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/dissect/lib/python3.12/site-packages/flow/record/stream.py", line 169, in record_stream
reader = RecordReader(src, selector=selector)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/dissect/lib/python3.12/site-packages/flow/record/base.py", line 925, in RecordReader
return RecordAdapter(url=url, out=False, selector=selector, fileobj=fileobj, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/dissect/lib/python3.12/site-packages/flow/record/base.py", line 894, in RecordAdapter
raise RecordAdapterNotFound("Could not find adapter for file-like object")
flow.record.exceptions.RecordAdapterNotFound: Could not find adapter for file-like objectEasiest way to reproduce this locally is to run:
echo | rdump -vvv
2026-01-18T06:51:06.740634Z [debug ] Creating <class 'flow.record.adapter.text.TextWriter'> for 'text://?' with args {'clobber': True} [flow.record.base]
2026-01-18T06:51:06.740892Z [debug ] Record stream with selector: None [flow.record.stream]
[reading from stdin]
2026-01-18T06:51:06.740951Z [error ] rdump encountered a fatal error: Could not find adapter for file-like object [flow.record.tools.rdump]
2026-01-18T06:51:06.740981Z [error ] Full traceback [flow.record.tools.rdump]
Traceback (most recent call last):
File "/opt/homebrew/Caskroom/miniforge/base/envs/dissect/lib/python3.12/site-packages/flow/record/tools/rdump.py", line 397, in main
for count, rec in enumerate(record_iterator, start=1): # noqa: B007
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/dissect/lib/python3.12/site-packages/flow/record/stream.py", line 169, in record_stream
reader = RecordReader(src, selector=selector)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/dissect/lib/python3.12/site-packages/flow/record/base.py", line 925, in RecordReader
return RecordAdapter(url=url, out=False, selector=selector, fileobj=fileobj, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/dissect/lib/python3.12/site-packages/flow/record/base.py", line 894, in RecordAdapter
raise RecordAdapterNotFound("Could not find adapter for file-like object")
flow.record.exceptions.RecordAdapterNotFound: Could not find adapter for file-like object