Explain this error Something went wrong in the co...
# ask-ai
d
Explain this error Something went wrong in the connector. See the logs for more details. expected string or bytes-like object
Copy code
Traceback (most recent call last):
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/async_job/job_orchestrator.py", line 243, in _start_job
    job = self._job_repository.start(_slice)
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/requesters/http_job_repository.py", line 162, in start
    response: requests.Response = self._start_job_and_validate_response(stream_slice)
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/requesters/http_job_repository.py", line 131, in _start_job_and_validate_response
    response: Optional[requests.Response] = self.creation_requester.send_request(
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/requesters/http_requester.py", line 452, in send_request
    request, response = self._http_client.send_request(
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/streams/http/http_client.py", line 524, in send_request
    response: requests.Response = self._send_with_retry(
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/streams/http/http_client.py", line 270, in _send_with_retry
    response = backoff_handler(rate_limit_backoff_handler(user_backoff_handler))(
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/backoff/_sync.py", line 105, in retry
    ret = target(*args, **kwargs)
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/backoff/_sync.py", line 105, in retry
    ret = target(*args, **kwargs)
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/backoff/_sync.py", line 105, in retry
    ret = target(*args, **kwargs)
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/streams/http/http_client.py", line 302, in _send
    response = self._session.send(request, **request_kwargs)
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/streams/call_rate.py", line 694, in send
    response = super().send(request, **kwargs)
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/requests/adapters.py", line 667, in send
    resp = conn.urlopen(
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    response = self._make_request(
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/urllib3/connectionpool.py", line 493, in _make_request
    conn.request(
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/urllib3/connection.py", line 493, in request
    self.putheader(header, value)
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/urllib3/connection.py", line 407, in putheader
    super().putheader(header, *values)
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/http/client.py", line 1260, in putheader
    if _is_illegal_header_value(values[i]):
TypeError: expected string or bytes-like object
Something went wrong in the connector. See the logs for more details. AirbyteTracedException("At least one job could not be completed for slice {}. Job statuses were: {'e5b519d5-c982-4b9e-b1a3-9bcf15ecd328 - Job that could not start': <AsyncJobStatus.FAILED: ('FAILED', True)>}. See warning logs for more information.")
Copy code
Traceback (most recent call last):
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/abstract_source.py", line 152, in read
    yield from self._read_stream(
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/abstract_source.py", line 276, in _read_stream
    for record_data_or_message in record_iterator:
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/streams/core.py", line 180, in read
    checkpoint_reader = self._get_checkpoint_reader(
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/declarative_stream.py", line 241, in _get_checkpoint_reader
    return super()._get_checkpoint_reader(logger, cursor_field, sync_mode, stream_state)
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/streams/core.py", line 487, in _get_checkpoint_reader
    stream_classification = self._classify_stream(
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/streams/core.py", line 553, in _classify_stream
    next_slice = next(mappings_or_slices)
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/retrievers/async_retriever.py", line 105, in stream_slices
    yield from self.stream_slicer.stream_slices()
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/partition_routers/async_job_partition_router.py", line 43, in stream_slices
    for completed_partition in self._job_orchestrator.create_and_get_completed_partitions():
  File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/site-packages/airbyte_cdk/sources/declarative/async_job/job_orchestrator.py", line 483, in create_and_get_completed_partitions
    raise AirbyteTracedException(
airbyte_cdk.utils.traced_exception.AirbyteTracedException: AirbyteTracedExceptio
k
The error message:
Copy code
TypeError: expected string or bytes-like object
indicates that somewhere in the Airbyte connector code, a function is expecting a string (or bytes), but it is receiving a different type (such as None, an integer, or another object). This is a common Python error when, for example, a header value, URL, or date string is expected, but the variable is not properly set or is of the wrong type. From the stack trace, the error occurs during the process of sending an HTTP request, specifically when setting HTTP headers:
Copy code
File "/home/airbyte/.pyenv/versions/3.10.18/lib/python3.10/http/client.py", line 1260, in putheader     if _is_illegal_header_value(values[i]): TypeError: expected string or bytes-like object
This suggests that one of the header values being set in the request is not a string or bytes-like object, which is required by the HTTP client library. Additionally, the error is wrapped in an AirbyteTracedException, indicating that the connector job could not be completed for a particular slice, likely due to this type error. What to do: - Check the configuration or code that sets HTTP headers for the connector. Ensure all header values are strings. - If you are using a declarative manifest or custom code, verify that any dynamic values used for headers (such as tokens, IDs, etc.) are not None or another type. - Review the logs for more details about which header or value is causing the issue. There is a similar error pattern in the Airbyte knowledge sources, where a "TypeError: expected string or bytes-like object" is raised in the context of parsing or handling data, such as with the Shopify connector when parsing ISO8601 durations or dates, which also points to a type mismatch (e.g., passing None instead of a string to a parser) [source-shopify issue](https://github.com/airbytehq/airbyte/issues/54163). In summary, this error is due to a type mismatch—most likely a header value or similar parameter is not a string as required by the HTTP client. Double-check your connector's configuration and code for any non-string values being used where a string is expected.
d
Why is it impossible in the new ui to set a customer header to pass the authentication code using OAuth2.. this is such a big gap that should be filled.
@kapa.ai Why is it impossible in the new ui to set a customer header to pass the authentication code using OAuth2.. this is such a big gap that should be filled.
k
A message from kapa.ai
Based on the knowledge sources, it is actually possible to set a custom header to pass the authentication code (or other OAuth2 parameters) in Airbyte’s new UI using the Declarative OAuth 2.0 specification. The documentation provides explicit examples of how to inject custom headers during the OAuth flow. For example, if your OAuth2 provider requires the client secret or another value to be sent as a header (instead of a query parameter), you can specify this in your connector manifest using the
access_token_headers
field. Here’s an example from the documentation:
Copy code
yaml access_token_url: >-   https://yourconnectorservice.com/oauth/token?client_id={{client_id_value}}&code={{auth_code_value}} access_token_headers:   SECRETHEADER: "{{ client_secret_value }}"
You can also encode values, such as using base64, directly in the header:
Copy code
yaml access_token_headers:   SECRETHEADER: "{{ (client_id_value ~ ':' ~ client_secret_value) | b64encode }}"
This approach is supported in both the current and next versions of the Airbyte platform, and is documented as a flexible way to handle non-standard OAuth2 implementations, including custom header injection for authentication codes or other credentials. If you are unable to set a custom header in your specific UI workflow, it may be due to a misconfiguration or a limitation in a particular connector, but the platform itself supports this feature through declarative configuration[Advanced Case: client secret is a request header not a query parameter](https://docs.airbyte.com/platform/next/connector-development/config-based/advanced-topics/oauth#advanced-case-client-secret-is-a-request-header-not-a-query-parameter). If you are experiencing issues, ensure you are using the Declarative OAuth 2.0 flow and that your connector manifest is configured correctly. If you are using the Connector Builder UI, refer to the advanced topics in the documentation for guidance on custom header injection[OAuth 2](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/authentication#oauth-2).