Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(data-imports): stop retrying invalid object storage endpoint (#85100)

Tom Owersd814ae47a1f3
diff --git a/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py b/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py
index 519bed8380a5..2bd296134267 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py
@@ -159,6 +159,17 @@ Any_Source_Errors: dict[str, str | None] = {
# it here so every other source stops retrying too. The enriched message names the offending column
# and shows example cells, so keep the raw error rather than replacing it with a generic one.
"must be real number, not str": None,
+ # Raised by botocore (`is_valid_endpoint_url`) when the object storage endpoint URL has a
+ # hostname it rejects — most often an underscore, invalid in a DNS hostname but common in a
+ # self-hosted deployment's OBJECT_STORAGE_ENDPOINT (e.g. a docker service name). The endpoint is
+ # fixed for the deployment, so every retry replays the identical ValueError. Batch exports already
+ # classifies this the same way (InvalidS3EndpointError). Match the stable "Invalid endpoint:"
+ # prefix, not the URL itself, which can carry deployment host detail.
+ "Invalid endpoint: ": (
+ "The object storage endpoint URL isn't valid. Its hostname contains characters that S3 "
+ "clients reject, such as an underscore. Fix the endpoint URL in your object storage settings, "
+ "then re-enable the sync."
+ ),
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_import_data_sync.py b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_import_data_sync.py
index a5e7b47cb193..6c2665c921b6 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_import_data_sync.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/tests/test_import_data_sync.py
@@ -476,14 +476,22 @@ async def test_jsonpath_error_routes_through_handler_without_source_opt_in():
logger.aexception.assert_not_awaited()
+ [
+ # Raised in shared pipeline code (delta merge) when a keyless table syncs incrementally.
+ ("primary_key", "Primary key required for incremental syncs"),
+ # Raised by botocore when the object storage endpoint hostname is one it rejects (e.g. an
+ # underscore in a self-hosted OBJECT_STORAGE_ENDPOINT). Deterministic for the deployment, so
+ # it must stop retrying instead of looping the activity's budget and reporting every attempt.
+ ("invalid_endpoint", "Invalid endpoint: http://posthog_objectstorage:19000"),
+ ]
+)
@pytest.mark.asyncio
-async def test_shared_non_retryable_error_routes_through_handler_without_source_opt_in():
- # "Primary key required for incremental syncs" is raised in shared pipeline code (delta merge),
- # not any one source, and lives in the shared Any_Source_Errors dict. It must be non-retryable in
- # this in-activity handler for every source, not just those that duplicate the message into their
- # own get_non_retryable_errors — otherwise a keyless incremental table retries the activity's whole
- # budget and reports on every attempt.
- error = Exception("Primary key required for incremental syncs")
+async def test_shared_non_retryable_error_routes_through_handler_without_source_opt_in(_name: str, message: str):
+ # These messages are raised in shared pipeline code, not any one source, and live in the shared
+ # Any_Source_Errors dict. Each must be non-retryable in this in-activity handler for every source,
+ # not just those that duplicate the message into their own get_non_retryable_errors.
+ error = Exception(message)
source = mock.MagicMock(spec=SimpleSource)
source.get_non_retryable_errors.return_value = {}
source.get_retryable_errors.return_value = set()