Skip to content

Commit 3b745af

Browse files
fix(source-marketo): handle missing 'result' key in Marketo API responses (AI-Triage PR) (#73309)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 31f0d31 commit 3b745af

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

airbyte-integrations/connectors/source-marketo/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ data:
1010
connectorSubtype: api
1111
connectorType: source
1212
definitionId: 9e0556f4-69df-4522-a3fb-03264d36b348
13-
dockerImageTag: 1.4.39
13+
dockerImageTag: 1.4.40
1414
dockerRepository: airbyte/source-marketo
1515
documentationUrl: https://docs.airbyte.com/integrations/sources/marketo
1616
githubIssueLabel: source-marketo

airbyte-integrations/connectors/source-marketo/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
33
build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
6-
version = "1.4.39"
6+
version = "1.4.40"
77
name = "source-marketo"
88
description = "Source implementation for Marketo."
99
authors = [ "Airbyte <contact@airbyte.io>",]

airbyte-integrations/connectors/source-marketo/source_marketo/source.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,11 @@ def should_retry(self, response: requests.Response) -> bool:
303303
if errors[0].get("code") == "1029" and re.match("Export daily quota \d+MB exceeded", errors[0].get("message")):
304304
message = "Daily limit for job extractions has been reached (resets daily at 12:00AM CST)."
305305
raise AirbyteTracedException(internal_message=response.text, message=message, failure_type=FailureType.config_error)
306-
result = response.json().get("result")[0]
307-
status, export_id = result.get("status", "").lower(), result.get("exportId")
306+
result = response.json().get("result")
307+
if not result:
308+
self.logger.warning("No 'result' in export create response, retrying. Response: %s", response.text[:500])
309+
return True
310+
status, export_id = result[0].get("status", "").lower(), result[0].get("exportId")
308311
if status != "created" or not export_id:
309312
self.logger.warning(f"Failed to create export job! Status is {status}!")
310313
return True
@@ -349,7 +352,12 @@ def path(self, **kwargs) -> str:
349352
return f"bulk/v1/{self.stream_name}/export/{self.export_id}/status.json"
350353

351354
def parse_response(self, response: requests.Response, **kwargs) -> List[str]:
352-
return [response.json()[self.data_field][0]["status"]]
355+
result = response.json().get(self.data_field)
356+
if not result:
357+
raise Exception(
358+
f"Unexpected response from export status endpoint: '{self.data_field}' key missing. Response: {response.text[:500]}"
359+
)
360+
return [result[0]["status"]]
353361

354362

355363
class Leads(MarketoExportBase):

docs/integrations/sources/marketo.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ If the 50,000 limit is too stringent, contact Marketo support for a quota increa
121121

122122
| Version | Date | Pull Request | Subject |
123123
|:---------|:-----------|:---------------------------------------------------------|:-------------------------------------------------------------------------------------------------|
124+
| 1.4.40 | 2026-02-12 | [TBD](https://github.com/airbytehq/airbyte/pull/TBD) | Fix KeyError and TypeError when Marketo API responses lack 'result' key in export status and create endpoints |
124125
| 1.4.39 | 2026-01-26 | [71849](https://github.com/airbytehq/airbyte/pull/71849) | Add error handling for type conversion in format_value |
125126
| 1.4.38 | 2025-10-21 | [68475](https://github.com/airbytehq/airbyte/pull/68475) | Update dependencies |
126127
| 1.4.37 | 2025-10-14 | [67858](https://github.com/airbytehq/airbyte/pull/67858) | Update dependencies |

0 commit comments

Comments
 (0)