Search code examples
pythonslackslack-apislack-block-kit

Nothing displayed when sending an "errors" response action to Slack when block has multiple elements


I have a block in a Slack view that looks like this:

{
  "type": "actions",
  "block_id": "start_block",
  "elements": [
    {
      "type": "datepicker",
      "placeholder": {
        "type": "plain_text",
        "text": "Select a date",
        "emoji": true
      },
      "action_id": "start_date"
    },
    {
      "type": "timepicker",
      "placeholder": {
        "type": "plain_text",
        "text": "Select a time",
        "emoji": true
      },
      "action_id": "start_time"
    }
  ]
}

I'm sending a response action to the view submission of that view using the Python Bolt SDK, like this:

response_action = "errors"
errors = {"start_block": "Start time cannot be in the past"}

ack(response_action=response_action, errors=errors)

However, Slack does not display any error messages in the view when it receives the response action, nor does it produce any errors in the log or close the modal, the view just remains unchanged. I've also tried printing Slack's response to the ack() and it's just sending back a 200 response.

I'm using the same type of response action in other view submission responses and they work fine, the only difference is that their blocks only have one element in them and this one has two.

Is there something I should be doing differently or does Slack just not support error response actions for multi-element blocks?


Solution

  • "response_action": "errors" is used to highlight invalid inputs, so must be keyed to a specific input block. You're using action blocks in the code snippet above, so there's no input block to attach the error to.

    If you switch to input blocks, it should work as expected.