<@U04S8PLJWMT> I am observing the following except...
# ask-ai
t
@kapa.ai I am observing the following exception stack trace when testing a stream in the Connector Builder. It uses another stream as its parent. Both streams use a request type of “Asynchronous Job”. Using Airbyte version 1.6.6.
Copy code
Traceback (most recent call last):
 File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/connector_builder/connector_builder_handler.py", line 83, in read_stream
 stream_read = test_read_handler.run_test_read(
 File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/connector_builder/test_reader/reader.py", line 112, in run_test_read
 stream = source.streams(config)[0]
 File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/manifest_declarative_source.py", line 159, in streams
 for stream_config in self._initialize_cache_for_parent_streams(deepcopy(stream_configs))
 File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/manifest_declarative_source.py", line 196, in _initialize_cache_for_parent_streams
 update_with_cache_parent_configs(partition_router["parent_stream_configs"])
 File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/manifest_declarative_source.py", line 181, in update_with_cache_parent_configs
 parent_config["stream"]["retriever"]["requester"]["use_cache"] = True
KeyError: 'requester'
k
The stack trace you provided indicates a
KeyError: 'requester'
when the Connector Builder tries to set
use_cache
on the parent stream's requester. This error occurs during the initialization of parent stream caching, which is a mechanism Airbyte uses to optimize nested (parent/child) stream relationships—especially when using substreams or partition routers. ### Why This Happens In Airbyte's config-based connectors, when you define a substream (child stream) that depends on a parent stream, the system expects the parent stream to have a
retriever
with a
requester
object. This is necessary because the caching mechanism is applied at the HTTP request level, and the
use_cache
property must be set on the
requester
to enable caching for the parent stream. If your parent stream's configuration is missing the
requester
key, the system cannot set
use_cache
, resulting in the
KeyError
you see. This is especially relevant when both streams use the "Asynchronous Job" request type, as the Connector Builder's internal logic still expects the parent stream to have a standard HTTP requester structure for caching to work with substreams. ### What To Check and How To Fix - Parent Stream Configuration: Ensure that your parent stream (the one being referenced by the child stream) has a
retriever
section with a
requester
defined. This is required for the caching mechanism to work. - Partition Router: If you are using a
SubstreamPartitionRouter
, make sure the parent stream is fully and correctly defined, including the
requester
object. - Connector Builder UI: When configuring asynchronous streams, double-check that both parent and child streams are set up with all required sections, especially the
requester
under
retriever
. #### Example (YAML snippet for config-based connector)
Copy code
yaml streams:   - name: parent_stream     retriever:       requester:         url_base: "https://api.example.com"         path: "/parent"         use_cache: true       ...   - name: child_stream     partition_router:       type: SubstreamPartitionRouter       parent_stream_configs:         - stream: "#/parent_stream"           parent_key: "id"           partition_field: "parent_id"
This structure ensures the parent stream has a
requester
for the caching logic to work as expected. ### Documentation Reference This behavior and the need for a
requester
in the parent stream are described in the Airbyte documentation on nested streams and caching, as well as in the section on substream partition routers. The caching mechanism relies on the parent stream's
requester
to function properly, and missing this key will cause the error you observed [Nested Streams & Caching](https://docs.airbyte.com/platform/1.6/connector-development/cdk-python/http-streams#nested-streams--caching), [SubstreamPartitionRouter](https://docs.airbyte.com/platform/1.6/connector-development/config-based/understanding-the-yaml-file/partition-router#substreampartitionrouter). --- Summary: Add a
requester
section to your parent stream's configuration. This should resolve the
KeyError: 'requester'
when using nested asynchronous streams in the Connector Builder. If you continue to see issues, double-check that all required fields for both parent and child streams are present and correctly structured.