Forum Discussion

mgray1998's avatar
mgray1998
Regular Visitor
1 year ago
Solved

An error occurred while processing the data in the semantic model.

Hi there,

 

I keep receiving this error with a few of my reports: An error occured while processing the data in the semantic model. Failure details: The last refresh attempt failed because of an internal service error. This is usually a transient issue. If you try again later and still see this message, contact support. <ccon>DataSource.Error: Web.Contents failed to get contents

 

This causes them to fail to refresh. For context, I am mainting reports that were created by someone else. My data sources are APIs connected through the web with an anonymous  authentication method and privacy level set to public. To fix the issue, I have just been editing the data credentials daily and saving the same credentials without changing anything (basically just refreshing the same credentials). However, I don't want to continue to have to do this everyday. Is there a better long term solution? 

 

I believe the issue might lay with the API itself but our developer doesn't seem to agree. 

  • I think you are right that the most likely issue is the API itself.  Even if the developer is skeptical, it’s common for publicly accessible APIs to intermittently:

    • Throttle requests (rate limiting).
    • Fail due to timeout or heavy load.
    • Return malformed or incomplete responses.

    The fact that re-entering the same credentials "resolves" the issue supports this; your manual refresh is essentially retrying the call, which eventually succeeds.

    Anonymous APIs often lack SLA guarantees or proper headers, and Power BI doesn’t retry Web.Contents fetches automatically.

    The other likely situation is a service timeout.  If the API call is complex (e.g., has dynamic parameters, headers, or paging logic), Web.Contents may not fully fold or may exceed timeout thresholds.

     

    If you are ingesting straight into a semantic model, I would encourage you to set up your ETL through dataflows and then ingest those flows into the semantic model.  At a minimum this will isolate the refresh failures to the query and not make the whole model refresh fail.

     

    You could also try to wrap Web.Contents with a try...otherwise 

    let
        Source = try Web.Contents("https://your.api.url/endpoint") otherwise null
    in
        Source


    Please mark this post as a solution if it helps you. Appreciate Kudos.

     

2 Replies

  •  mgray1998 
    Possible long-term fixes:

    1. Use a proper Authentication method (if available)

      • If the API supports a key/token, switch from anonymous to that.

      • Tokens often refresh automatically or have longer validity.

      • Cache or stage API data in a database or data lake

        • Instead of Power BI calling API every refresh, build a scheduled ETL process (e.g., Azure Data Factory, Logic Apps) to pull API data and save it in SQL or Blob storage.

        • Power BI then reads from that stable data source, reducing API failures.

        • Set Privacy Levels Carefully

          • Ensure all sources involved use compatible privacy levels.

          • Avoid mixing Public with Organizational or Private sources in the same query.

          • Error handling in M Query

            • Use try ... otherwise to handle API errors gracefully and avoid refresh failure.

            • Example:

              Source = try Web.Contents("your API URL") otherwise null
            • This won’t fix the root cause but can avoid refresh breaks.

            • Scheduled Refresh Settings

              • If using Power BI Service, try to stagger refreshes to avoid API throttling.

              • Also consider incremental refresh to reduce load.

              • Monitor API health/logs

                • Track API uptime and response times (there are monitoring tools for this).

                  This helps argue with developers if the API really has issues.

                  Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

    mgray1998

  • I think you are right that the most likely issue is the API itself.  Even if the developer is skeptical, it’s common for publicly accessible APIs to intermittently:

    • Throttle requests (rate limiting).
    • Fail due to timeout or heavy load.
    • Return malformed or incomplete responses.

    The fact that re-entering the same credentials "resolves" the issue supports this; your manual refresh is essentially retrying the call, which eventually succeeds.

    Anonymous APIs often lack SLA guarantees or proper headers, and Power BI doesn’t retry Web.Contents fetches automatically.

    The other likely situation is a service timeout.  If the API call is complex (e.g., has dynamic parameters, headers, or paging logic), Web.Contents may not fully fold or may exceed timeout thresholds.

     

    If you are ingesting straight into a semantic model, I would encourage you to set up your ETL through dataflows and then ingest those flows into the semantic model.  At a minimum this will isolate the refresh failures to the query and not make the whole model refresh fail.

     

    You could also try to wrap Web.Contents with a try...otherwise 

    let
        Source = try Web.Contents("https://your.api.url/endpoint") otherwise null
    in
        Source


    Please mark this post as a solution if it helps you. Appreciate Kudos.