Encountered an exception while reading stream Trac...
# ask-ai
g
Encountered an exception while reading stream Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/abstract_source.py", line 135, in read yield from self._read_stream( File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/abstract_source.py", line 230, in _read_stream for record_data_or_message in record_iterator: File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/core.py", line 158, in read next_slice = checkpoint_reader.next() ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/airbyte_cdk/sources/streams/checkpoint/checkpoint_reader.py", line 115, in next return next(self._stream_slices) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/airbyte/integration_code/source_shift_cdk_salesforce_logs/streams/event_log_content.py", line 35, in stream_slices for record in parent_stream.read_records( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: airbyte_cdk.sources.streams.http.http.HttpStream.read_records() got multiple values for keyword argument 'sync_mode'
k
The error message:
Copy code
TypeError: airbyte_cdk.sources.streams.http.http.HttpStream.read_records() got multiple values for keyword argument 'sync_mode'
indicates that the
read_records
method is being called with the
sync_mode
argument more than once, likely both as a positional and a keyword argument, or it's being passed in multiple ways. This is a common issue when overriding or calling methods in Airbyte's CDK, especially when working with nested or parent/child streams. The knowledge sources provide several examples of similar issues: - When implementing nested streams, it's important to ensure that the method signatures match what the Airbyte CDK expects. For example, in one forum post, a user encountered a similar error due to missing or mismatched arguments in the
stream_slices
method, and the solution was to ensure the correct method signature and argument passing, especially for
sync_mode
and
config
parameters. You should check how you are calling
read_records
and make sure you are not passing
sync_mode
twice, or both positionally and as a keyword argument. Review the method signature and how you are invoking it in your code, especially in the context of nested streams or when calling a parent stream from a child stream's
stream_slices
method. See the discussion here for a similar context: [Implementing nested stream using full refresh parent](https://discuss.airbyte.io/t/3084) and [Passing stream results into a secondary stream's API path](https://discuss.airbyte.io/t/2701). - Also, ensure that your method signatures for
stream_slices
and
read_records
match the expected ones from the Airbyte CDK. For example, the correct signature for
stream_slices
should include all required parameters, and you should avoid passing unexpected or duplicate arguments, as seen in the error:
stream_slices() got an unexpected keyword argument 'sync_mode'
or
missing 2 required positional arguments: 'sync_mode' and 'stream_state'
in other issues ([source-railz Incremental sync fails](https://github.com/airbytehq/airbyte/issues/42416), [Using an array instead of a string in the config](https://discuss.airbyte.io/t/586)). Actionable steps: - Review the call to
read_records
in your
event_log_content.py
file, especially in the
stream_slices
method. - Ensure you are not passing
sync_mode
more than once. - Double-check the method signatures and how arguments are passed between parent and child streams. If you need more specific guidance, please provide the relevant code snippet where
read_records
is called. If you need more details on nested streams and argument passing, see the Airbyte documentation on [HTTP-API-based Connectors](https://docs.airbyte.com/connector-development/cdk-python/http-streams#nested-streams--caching) and the referenced forum discussions.