dfinn
dfinn

Reputation: 1008

Errors when using DialogFlow "restore agent" API

We have suddenly started experiencing an error when using the DialogFlow "restore agent" API. The call is failing with the error:

400 com.google.apps.framework.request.BadRequestException: Invalid agent zip. Missing required json file agent.json

Oddly, it only seems to happen for newly created DialogFlow agents, but not for older/existing ones. We are using this API so that we can programmatically create a custom agent using our own intents/entities. This code has been working for about the past two years, with no changes on our side. We are using the official DialogFlow client library for Python. We have been on version 0.2.0, and I tried updating to the latest (0.8.0) but there was no change.

I tried changing our code to include the agent.json file (by using the "export agent" API and getting the agent.json file from there). In that case, I no longer get the above error and the restore appears to succeed. However, the agent then seems to be corrupt in some way. When trying to click on any intent -- or various other operations in the DialogFlow console -- I get the error:

Failed to get Training Phrases Errorid=xxx

(where xxx seems to be a UUID that changes each time)

Trying to export the agent in that state also displays an error:

Error downloading agent

Occasionally, even including the agent.json as above, the restore will still fail but return the error:

500 Internal error encountered.

I appreciate any ideas on how we can get this working again. Thanks!

Upvotes: 0

Views: 1991

Answers (2)

Sridhar Iyer
Sridhar Iyer

Reputation: 2840

Easy way to fix is to export one of the existing agents and copy it's agent.json and package.json into your current directory before uploading.

agent.json is now required by dialogflow.

Upvotes: 0

dfinn
dfinn

Reputation: 1008

After a lot of trial and error I found the solution. Here it is in case anyone else runs into this. Something must have changed recently in how DialogFlow processes the zip upload during the "restore agent" operation --

1) The agent.json file is now required in the zip file, where before it was optional

2) We found some of the "id" elements in our _usersays files for various intents were not valid UUIDs. Previously this did not cause any error, but now the agent winds up in an invalid state ("Failed to get Training Phrases" error, etc as mentioned above).

Upvotes: 2

Related Questions