High severityexecution
Power BI Refresh Error:
002140
What does this error mean?
Snowflake received an error response from the external API endpoint when invoking an external function, often because the remote service returned a non-200 HTTP status or an unexpected payload format.
Common causes
- 1The external API endpoint returned a 4xx or 5xx HTTP status code
- 2The API gateway (AWS API Gateway, Azure API Management) rejected the request due to throttling or auth failure
- 3The response payload from the remote service did not match the expected JSON array format Snowflake requires
- 4The external function's MAX_BATCH_ROWS setting sends too many rows, exceeding the API payload size limit
How to fix it
- 1Step 1: Run the external function with a single test row and inspect the error details in the Snowflake query history.
- 2Step 2: Check the API gateway logs for the actual HTTP response code and body returned to Snowflake.
- 3Step 3: Verify the remote service is healthy and the API endpoint URL has not changed.
- 4Step 4: Confirm the Snowflake API integration IAM role or Entra app still has permission to invoke the API gateway.
- 5Step 5: Reduce MAX_BATCH_ROWS on the external function if payload size is causing gateway rejections.