Datasource 'X' not found for workbook XYZ
Describe of bug
When publishing workbooks using TSC's workbooks.publish() method, the operation consistently fails (until a few days ago it was working fine) with a "Datasource 'X' not found" error even when:
-
The referenced datasource verifiably exists on the destination server
-
The datasource is in the same project as the target workbook
-
Authentication is successful and permissions are correct
-
The workbook XML has been comprehensively cleaned of source server references
This appears to be a server-side validation issue within Tableau's publishing pipeline that cannot be resolved through standard TSC parameters or XML manipulation.
Versions
-
Tableau Server version: Tableau Cloud (Online)
-
Python version: 3.10
-
TSC library version: Latest (installed via pip)
To Reproduce
import tableauserverclient as TSC
# 1. Authenticate and connect to destination server
tableau_auth = TSC.PersonalAccessTokenAuth(token_name, token_value, site_id)
server = TSC.Server(server_url, use_server_version=True)
with server.auth.sign_in(tableau_auth):
# 2. Verify datasource exists on destination
all_datasources = list(TSC.Pager(server.datasources))
target_datasource = next((ds for ds in all_datasources if ds.name == 'target_datasource_name'), None)
print(f"Datasource exists: {target_datasource is not None}") # Returns True
# 3. Prepare workbook for publishing
workbook_item = TSC.WorkbookItem(name="Test Workbook", project_id=project_id)
# 4. Attempt to publish workbook that references the verified datasource
published_workbook = server.workbooks.publish(
workbook_item,
'/path/to/workbook.twbx',
mode=TSC.Server.PublishMode.Overwrite,
skip_connection_check=True
)
Current Results
tableauserverclient.server.endpoint.exceptions.ServerResponseError:
400011: Bad Request There was a problem publishing the file 'workbook.twbx'.. (0x9F4C1551 : com.tableausoftware.domain.exception.PublishingException: Datasource 'target_datasource_name' not found for workbook 'Test Workbook'.)
Expected Results
The workbook should publish successfully when the referenced datasource exists on the destination server in the same project, especially when skip_connection_check=True is specified.
Things I've already tried
-
Verified datasource exists via server.datasources.get_by_id() and query operations
-
Confirmed both workbook and datasource are in the same project
-
Removed all XML references to source server (derived-from attributes, server URLs, extract elements)
-
Attempted multiple datasource naming strategies
-
Verified authentication and permissions are correct
-
Tested with skip_connection_check=True parameter
Additional Info
I'm able to successfully publish workbooks that only have an embedded extract. Also, data sources are successfully being published to destination as well.
In your workbook XML, there should be an element at /workbook/datasources/datasource/repository-location that has multiple attributes, including:
- derived-from
- id
- path
- site
Then at the accompanying /workbook/datasources/datasource/connection has the following attributes:
- dbname
- server
All of these attributes need to reflect your destination server and site. You said
Removed all XML references to source server
But the issue is that you need to update all of these references, not simply remove them.
I can't really see many instances of this in the logs at all - were you working with the Admin Insights project? If it was working and stopped working with no change on your side, then support should be willing to take a look, but hand-editing the XML is not generally supported.
We too just recently faced this issue, seems to be when Tableau Online upgraded to 2025.2. Was working perfectly fine and then started receiving this error during our ci/cd where we publish datasource/workbooks to varying sites dev/staging/prod.
Hi guys, any solution about this problem? I'm having the same one. Tried to update all the old ds mentions in the xml, but none. Anything?