Error "Empty speech response"

electrobabe picture electrobabe · Jan 27, 2018 · Viewed 8.5k times · Source

I tried to connect DialogFlow and Actions on Google, so I created some intents, connected the services, added explicit and implicit invocations etc, but when I try the bot in the simulator https://console.actions.google.com/project/[projectId]/simulator/ it always gives me the error:

"Failed to parse Dialogflow response into AppResponse, exception thrown with message: Empty speech response"

even tough inputType was "KEYBOARD".

What I tried so far:

Unfortunately the docs don't say anything about this error. Any ideas?

Here a screenshot of the error on the Actions integration: enter image description here

This is the full debug output:

{
  "agentToAssistantDebug": {
    "agentToAssistantJson": {
      "message": "Failed to parse Dialogflow response into AppResponse, exception thrown with message: Empty speech response",
      "apiResponse": {
        "id": "c12e1389-e887-49d4-b399-a332188ca946",
        "timestamp": "2018-01-27T03:55:30.931Z",
        "lang": "en-us",
        "result": {},
        "status": {
          "code": 200,
          "errorType": "success"
        },
        "sessionId": "1517025330705"
      }
    }
  },
  "assistantToAgentDebug": {
    "assistantToAgentJson": {
      "user": {
        "userId": "USER_ID",
        "locale": "en-US",
        "lastSeen": "2018-01-27T03:55:03Z"
      },
      "conversation": {
        "conversationId": "1517025330705",
        "type": "NEW"
      },
      "inputs": [
        {
          "intent": "actions.intent.MAIN",
          "rawInputs": [
            {
              "inputType": "KEYBOARD",
              "query": "Talk to Mica, the Hipster Cat Bot"
            }
          ]
        }
      ],
      "surface": {
        "capabilities": [
          {
            "name": "actions.capability.MEDIA_RESPONSE_AUDIO"
          },
          {
            "name": "actions.capability.WEB_BROWSER"
          },
          {
            "name": "actions.capability.AUDIO_OUTPUT"
          },
          {
            "name": "actions.capability.SCREEN_OUTPUT"
          }
        ]
      },
      "isInSandbox": true,
      "availableSurfaces": [
        {
          "capabilities": [
            {
              "name": "actions.capability.AUDIO_OUTPUT"
            },
            {
              "name": "actions.capability.SCREEN_OUTPUT"
            }
          ]
        }
      ]
    },
    "curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=TOKEN' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: AUTH_TOKEN'  -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{\"user\":{\"userId\":\"USER_ID\",\"locale\":\"en-US\",\"lastSeen\":\"2018-01-27T03:55:03Z\"},\"conversation\":{\"conversationId\":\"1517025330705\",\"type\":\"NEW\"},\"inputs\":[{\"intent\":\"actions.intent.MAIN\",\"rawInputs\":[{\"inputType\":\"KEYBOARD\",\"query\":\"Talk to Mica, the Hipster Cat Bot\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"},{\"name\":\"actions.capability.WEB_BROWSER\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]}]}'"
  },
  "sharedDebugInfo": [
    {
      "name": "ResponseValidation",
      "subDebugEntry": [
        {
          "debugInfo": "API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\".",
          "name": "UnparseableJsonResponse"
        }
      ]
    }
  ]
}

Also "debugInfo" sounds like an internal problem:

"API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\"."

Here a screenshot of the welcome intent: enter image description here

ps. It took me AGES to figure out, what

"Query pattern is missing for custom intent"

means - so I just document it here: In Dialog Flow - Intent - "User says" you have to DOUBLE CLICK on a word in the text input field when you want to set it as query parameter - which seems to be required for Actions on Google.

Answer

Femi picture Femi · Aug 20, 2018

This happened to me. If this happens for an Intent you just added in the Dialogflow console and you are using Webhook fulfillment for the action, check the intent's fulfillment settings and ensure that the Webhook fulfillment slider is on. Evidently new intents don't automatically get webhook fulfillment: you have to opt each one in piecemeal (or at least, that was my experience).