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(github): name the repository in the malformed-format error (#79420)

Tom Owersd50978902905
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/github/github.py b/products/warehouse_sources/backend/temporal/data_imports/sources/github/github.py
index 4cffd8060409..2d84b98035de 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/github/github.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/github/github.py
@@ -349,9 +349,12 @@ def validate_credentials(
# before the request so the message names the fix.
repo = repository.strip()
if repo.count("/") != 1 or not all(repo.split("/")):
+ # Name the offending entry, like the 404 message below. Without it, two malformed repos both
+ # return this identical sentence and the caller joins them into one repeated string that names
+ # neither.
return (
False,
- "Enter the repository as owner/repo (for example, posthog/posthog), not a full URL or just the owner name.",
+ f"'{repo}' isn't a valid repository. Enter it as owner/repo (for example, posthog/posthog), not a full URL or just the owner name.",
)
url = f"{GITHUB_BASE_URL}/repos/{repository}"
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/github/tests/test_github_validate_credentials.py b/products/warehouse_sources/backend/temporal/data_imports/sources/github/tests/test_github_validate_credentials.py
index 91d78c56e3bf..d9c0c1f85c1e 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/github/tests/test_github_validate_credentials.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/github/tests/test_github_validate_credentials.py
@@ -62,3 +62,6 @@ def test_malformed_repository_gets_format_guidance(repository):
assert is_valid is False
assert message is not None
assert "owner/repo" in message
+ # Naming the offending entry keeps two malformed repos from collapsing into one repeated
+ # sentence when the source layer joins their failures.
+ assert repository.strip() in message