Sub topic 14
Troubleshooting common refresh and gateway failures
This chapter assumes you can build a report in Power BI Desktop, you have a standard-mode gateway registered with at least one data source, and you have read the chapters on refresh history, network ports, and gateway maintenance. It gives you a repeatable way to find the cause of a failed refresh and covers the failures you will meet most often.
Start with where the failure happens
A refresh passes through several components. The Power BI service starts the refresh. It sends the request to the gateway through Azure Service Bus. The gateway connects to the data source with stored credentials. The data comes back, and the service loads it into the dataset. A failure can occur at any step, and each step leaves different evidence.
Work from the outside in:
- Open the refresh history and read the error message and its details. The details contain an activity ID and a request ID that you will need if you contact support.
- Check the gateway status in the Manage connections and gateways page. A gateway that is offline explains many failures immediately.
- Check the data source entry on that gateway, using its Test connection option.
- If those pass, look at the gateway machine itself: its network access, service account, and logs.
Gateway is offline or unreachable
The service reports that the gateway is not reachable, or the gateway shows as offline. The usual causes are:
- The gateway Windows service is stopped, or the machine was restarted or shut down.
- The machine cannot make outbound connections to Azure Service Bus.
- The gateway is a member of a cluster, and none of the members are online.
First confirm the service is running. Then test outbound connectivity from the gateway machine. The Service Bus endpoint below uses one of the TCP ports the gateway relies on.
Test-NetConnection -ComputerName watchdog.servicebus.windows.net -Port 9350If TcpTestSucceeded is False, a firewall or proxy is blocking the traffic. Ask the network team to allow outbound traffic for the ports and endpoints listed in the gateway network documentation. The gateway only makes outbound connections, so you should not need to open any inbound ports.
You can also run the network ports test in the gateway app's Diagnostics tab. It tests the same endpoints from the machine that matters.
Credentials expired or rejected
Messages such as "The credentials provided for the data source are invalid" or "Login failed for user" point to the stored credentials. Typical causes:
- The password of the account used by the data source changed, and the gateway still stores the old one.
- The account is locked or lacks read permission on the database.
- The authentication method is wrong. For example, the data source uses Windows authentication, but you entered a SQL login.
- For OAuth2 sources, the token expired and the source needs to be signed in again.
Open the data source on the gateway, edit the credentials, and select Test connection. Then retry the refresh. Credentials belong to the gateway data source, so one correction fixes every dataset mapped to it.
The dataset is not mapped to the gateway
A refresh may fail with a message saying the dataset has a data source that cannot be accessed through a gateway, or the settings page may show "You have no gateway installed or configured for the data sources in this dataset." The cause is almost always a mismatch between the dataset and the gateway data source. The service matches them by comparing the server name and database name exactly.
Consider this query:
let
Source = Sql.Database("sql01.contoso.local", "Sales"),
Orders = Source{[Schema = "dbo", Item = "Orders"]}[Data]
in
OrdersThe gateway data source must use the server sql01.contoso.local and the database Sales. Entering SQL01 or the IP address instead causes a mismatch even though they reach the same machine. Common variants of this problem:
- A developer changed the server name in Power BI Desktop and republished, so the dataset now points to a different server than the gateway data source.
- The dataset has two sources (for example SQL Server and an Excel file), and only one has a gateway data source. Every source that is on premises needs its own entry.
- The user who owns the dataset is not listed as a user on the gateway data source.
- A dynamic data source, where the query builds the server name or a path at run time, cannot be validated by the service. This is a common reason a dataset that works in Desktop refuses to refresh. Rewrite the query to use a static source and pass the variable part through parameters or filters.
Timeouts and resource limits
A refresh that starts and then fails after a long time usually hit a limit. The refresh limits chapter lists the exact values. In practice you will see the following:
| Symptom | Likely cause | Action |
|---|---|---|
| Failure close to a fixed duration, such as two hours on shared capacity | Refresh time limit | Reduce data volume, filter columns, or use incremental refresh |
| "Query timeout expired" from the source | Slow source query | Index the source, simplify the query, or let the source fold work |
| Out of memory error | Dataset too large for its capacity | Remove unused columns, lower precision, or use a larger capacity |
| Refresh skipped or disabled | Several consecutive failures | Fix the cause, then re-enable the schedule |
Power BI disables a schedule automatically after repeated consecutive failures, so a schedule that quietly stopped running often has an older failure behind it. Also check whether the gateway machine is short of CPU or memory when many refreshes start at the same hour. Staggering your schedule times spreads the load.
Query folding and slow data sources
If a refresh is slow but not failing, look at the query. Steps that Power Query cannot translate to the source (custom functions, some merges, or certain type changes) force the gateway to download all rows and process them locally. The gateway machine then needs enough memory and disk for the work. Moving filter steps early in the query so they fold to the source is often the cheapest fix.
Using gateway logs
When the history message is vague, the gateway logs hold more detail. In the gateway app, the Diagnostics tab has an option to export logs into a zip file. You can also enable additional logging for a short time while you reproduce the problem. Look for these items:
- The activity ID from the refresh history, so you find the correct entry.
- Errors from the data source provider, which often include the real SQL Server or ODBC message.
- Messages about reaching Service Bus, which indicate connection loss.
Turn additional logging off afterward, because it can grow quickly and may capture more detail than you want to keep.
Reproduce the refresh with the REST API
To retest quickly after a fix, start a refresh on demand and read its result instead of waiting for the schedule.
Connect-PowerBIServiceAccount
$groupId = '<workspace-id>'
$datasetId = '<dataset-id>'
$body = '{"notifyOption":"MailOnFailure"}'
Invoke-PowerBIRestMethod -Method Post -Url "groups/$groupId/datasets/$datasetId/refreshes" -Body $bodyInvoke-PowerBIRestMethod -Method Get -Url "groups/$groupId/datasets/$datasetId/refreshes?`$top=5"The second call returns the latest attempts with their status and times. The history also records whether an attempt was scheduled or on demand, which helps you separate a problem with the schedule from a problem with the data source.
Other failures worth knowing
- Gateway version too old. A gateway that has not been updated for several months can stop working. Update it and restart the service.
- Time zone confusion. A schedule runs in the time zone you set. If the failure pattern follows a daylight saving change, check the
localTimeZoneIdvalue in the schedule. - Cluster members out of sync. In a cluster, the same data source must work from every member. A member missing a driver or a firewall rule fails only when the service picks that member, which looks like an intermittent error. Test each member separately.
- Missing driver on the gateway. A source that works in Desktop may need the same provider or ODBC driver installed on the gateway machine.
- Service account changes. If the gateway service account lost access to a file share or lost its logon right, file sources fail while SQL sources continue to work.
A short checklist
- Read the error and details in the refresh history.
- Confirm the gateway is online.
- Test the data source connection.
- Compare server and database names between the query and the gateway data source.
- Check the user is allowed on the data source.
- Check limits and failure counts.
- Export logs and search by activity ID.
- Fix, run an on-demand refresh, and read the result.
Exercise
A dataset refreshes correctly in Power BI Desktop. After publishing, the scheduled refresh fails and the settings page says no gateway is configured for the data sources. The gateway is online and the data source test succeeds. The query uses Sql.Database("SQL01", "Sales"), and the gateway data source is defined with server "sql01.contoso.local" and database "Sales". What is wrong, and how do you fix it?
Show answer
The service maps a dataset to a gateway data source by matching the server and database names exactly. "SQL01" does not match "sql01.contoso.local", so the dataset has no matching data source. Either change the query in Power BI Desktop to use sql01.contoso.local and republish, or create a gateway data source that uses "SQL01". Then confirm the dataset owner is a user on that data source and retry the refresh.
Exercise
A refresh worked for weeks. It now fails every night, and the error says login failed for the data source user. Where do you apply the fix, and why does one change fix several datasets?
Show answer
Update the credentials on the gateway data source in Manage connections and gateways, then use Test connection. Credentials are stored on the gateway data source, not on each dataset, so every dataset mapped to that data source uses the corrected credentials. After that, re-enable the schedule if it was disabled and run an on-demand refresh to confirm.