Forum Discussion

dbeavon3's avatar
dbeavon3
Memorable Member
3 years ago

Power BI REST API Import Dataflow Overwrite error (DuplicatePackageNotFoundError issue in 2023)

Hi PBI Team,

 

It seems there is an issue with the Power BI REST API when attempting to Import a dataflow with an ImportConflictHandlerMode of "Overwrite".

 

Steps:

Create the following request (Overwrite)

 

curl -X POST \
  'https://api.powerbi.com/v1.0/myorg/groups/{{workspaceId}}/imports?datasetDisplayName=model.json&nameConflict=Overwrite' \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Authorization: Bearer {{authorizationToken}}' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: 1522' \
  -H 'Content-Type: application/json' \
  -H 'Host: api.powerbi.com' \
  -H 'Postman-Token: 98346372-e9c3-4c82-afdd-50050023c55f,ad5ca53d-35bf-4258-b487-b9e328e0baa6' \
  -H 'User-Agent: PostmanRuntime/7.15.2' \
  -H 'cache-control: no-cache' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
  -F =@/{{pathToDataflowJson}}

Expected behavior is for the request to successfully:

- overwrite the dataflow if a dataflow with the same name already exists

 

 

However, I often see a received response 404 Not Found with a body of:

{
    "error": {
        "code": "DuplicatePackageNotFoundError",
        "pbi.error": {
            "code": "DuplicatePackageNotFoundError",
            "parameters": {},
            "details": []
        }
    }
}

 

 

Other observed behavior:

 

 

1. Creating the dataflow first by hitting 

POST https://api.powerbi.com/v1.0/myorg/groups/{{workspaceId}}/imports?datasetDisplayName=model.json

...first ... and then executing either of these will work :



POST https://api.powerbi.com/v1.0/myorg/groups/{{workspaceId}}/imports?datasetDisplayName=model.json&nameConflict=CreateOrOverwrite

POST https://api.powerbi.com/v1.0/myorg/groups/{{workspaceId}}/imports?datasetDisplayName=model.json&nameConflict=Overwrite


These work as expected i.e. the dataflow is overwritten.

 

 

In other words, I can't overwrite with an ImportConflictHandlerMode of "Overwrite".  I can't do that.... except when I can
Please help.

 

 

7 Replies

    • dbeavon3's avatar
      dbeavon3
      Memorable Member

      Hi lbendlin 

      Do you understand any part of the language from this message (DuplicatePackageNotFoundError)?

       

      What is a "package"?  Why and when is it "duplicated"?  Why would it matter if a duplicated package couldn't be found?

       

      Nothing about this message seems to intersect with my understanding of dataflows.

       

      The only thing I can guess is that it is an internal/technical message that Microsoft never intended to be seen by customers.  Also the language is so strange that I'm guessing that it is related to some internal dependency that the dataflow is relying on (like an azure storage account for the storage of the dataflow results or something).

       

      • lbendlin's avatar
        lbendlin
        Super User

        Your guess is as good as mine (wich is that this call requires the dataflow JSON to exist to be overwritable, but sometimes cannot find it) but my suggestion is to ask the Microsoft technical support team to explain it .