From 31119b7ec37519d9034ac54af4da38266fb94573 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 20:24:00 +0000 Subject: [PATCH 1/2] fix: improve ERROR_READING_FILE message and raise AirbyteTracedException with system_error Replace misleading credential-focused error message with accurate 'File read failed during availability check.' message. Raise AirbyteTracedException with FailureType.system_error instead of CheckAvailabilityError, since the error is not necessarily caused by invalid credentials. Resolves https://github.com/airbytehq/airbyte-internal-issues/issues/16082 Co-Authored-By: bot_apk --- .../default_file_based_availability_strategy.py | 7 +++++-- airbyte_cdk/sources/file_based/exceptions.py | 2 +- unit_tests/sources/file_based/scenarios/check_scenarios.py | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/airbyte_cdk/sources/file_based/availability_strategy/default_file_based_availability_strategy.py b/airbyte_cdk/sources/file_based/availability_strategy/default_file_based_availability_strategy.py index c9d416a72..9dea3a1a0 100644 --- a/airbyte_cdk/sources/file_based/availability_strategy/default_file_based_availability_strategy.py +++ b/airbyte_cdk/sources/file_based/availability_strategy/default_file_based_availability_strategy.py @@ -9,6 +9,7 @@ from typing import TYPE_CHECKING, Optional, Tuple from airbyte_cdk import AirbyteTracedException +from airbyte_cdk.models import FailureType from airbyte_cdk.sources import Source from airbyte_cdk.sources.file_based.availability_strategy import ( AbstractFileBasedAvailabilityStrategy, @@ -133,8 +134,10 @@ def _check_parse_record( except AirbyteTracedException as ate: raise ate except Exception as exc: - raise CheckAvailabilityError( - FileBasedSourceError.ERROR_READING_FILE, stream=stream.name, file=file.uri + raise AirbyteTracedException( + message=FileBasedSourceError.ERROR_READING_FILE.value, + internal_message=f"Error reading file {file.uri} in stream {stream.name}: {exc}", + failure_type=FailureType.system_error, ) from exc schema = stream.catalog_schema or stream.config.input_schema diff --git a/airbyte_cdk/sources/file_based/exceptions.py b/airbyte_cdk/sources/file_based/exceptions.py index cd727463a..5a2c96337 100644 --- a/airbyte_cdk/sources/file_based/exceptions.py +++ b/airbyte_cdk/sources/file_based/exceptions.py @@ -17,7 +17,7 @@ class FileBasedSourceError(Enum): ERROR_CASTING_VALUE_UNRECOGNIZED_TYPE = "Could not cast the value to the expected type because the type is not recognized. Valid types are null, array, boolean, integer, number, object, and string." ERROR_DECODING_VALUE = "Expected a JSON-decodeable value but could not decode record." ERROR_LISTING_FILES = "Error listing files. Please check the credentials provided in the config and verify that they provide permission to list files." - ERROR_READING_FILE = "Error opening file. Please check the credentials provided in the config and verify that they provide permission to read files." + ERROR_READING_FILE = "File read failed during availability check." ERROR_PARSING_RECORD = "Error parsing record. This could be due to a mismatch between the config's file type and the actual file type, or because the file or record is not parseable." ERROR_PARSING_USER_PROVIDED_SCHEMA = ( "The provided schema could not be transformed into valid JSON Schema." diff --git a/unit_tests/sources/file_based/scenarios/check_scenarios.py b/unit_tests/sources/file_based/scenarios/check_scenarios.py index 9a235b9e6..74260aa1f 100644 --- a/unit_tests/sources/file_based/scenarios/check_scenarios.py +++ b/unit_tests/sources/file_based/scenarios/check_scenarios.py @@ -3,6 +3,7 @@ # from airbyte_cdk.sources.file_based.exceptions import FileBasedSourceError +from airbyte_cdk.utils.traced_exception import AirbyteTracedException from unit_tests.sources.file_based.helpers import ( FailingSchemaValidationPolicy, TestErrorListMatchingFilesInMemoryFilesStreamReader, @@ -158,7 +159,7 @@ ) ) ) - .set_expected_check_error(None, FileBasedSourceError.ERROR_READING_FILE.value) + .set_expected_check_error(AirbyteTracedException, FileBasedSourceError.ERROR_READING_FILE.value) ).build() @@ -222,5 +223,5 @@ ], } ) - .set_expected_check_error(None, FileBasedSourceError.ERROR_READING_FILE.value) + .set_expected_check_error(AirbyteTracedException, FileBasedSourceError.ERROR_READING_FILE.value) ).build() From 6d6ca325df25cd8fed2fdf4eba1a78334060fb09 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 20 Mar 2026 20:37:07 +0000 Subject: [PATCH 2/2] fix: revert test scenarios to expect None since AirbyteTracedException is caught by check_connection Co-Authored-By: bot_apk --- unit_tests/sources/file_based/scenarios/check_scenarios.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/unit_tests/sources/file_based/scenarios/check_scenarios.py b/unit_tests/sources/file_based/scenarios/check_scenarios.py index 74260aa1f..9a235b9e6 100644 --- a/unit_tests/sources/file_based/scenarios/check_scenarios.py +++ b/unit_tests/sources/file_based/scenarios/check_scenarios.py @@ -3,7 +3,6 @@ # from airbyte_cdk.sources.file_based.exceptions import FileBasedSourceError -from airbyte_cdk.utils.traced_exception import AirbyteTracedException from unit_tests.sources.file_based.helpers import ( FailingSchemaValidationPolicy, TestErrorListMatchingFilesInMemoryFilesStreamReader, @@ -159,7 +158,7 @@ ) ) ) - .set_expected_check_error(AirbyteTracedException, FileBasedSourceError.ERROR_READING_FILE.value) + .set_expected_check_error(None, FileBasedSourceError.ERROR_READING_FILE.value) ).build() @@ -223,5 +222,5 @@ ], } ) - .set_expected_check_error(AirbyteTracedException, FileBasedSourceError.ERROR_READING_FILE.value) + .set_expected_check_error(None, FileBasedSourceError.ERROR_READING_FILE.value) ).build()