Skip to content

SlackObjectFormationError: options attribute must have between 2 and 5 items whereas API allows a single option #1218

@wilhelmklopp

Description

@wilhelmklopp

Reproducible in:

The Slack SDK version

slack-sdk==3.16.1

Python runtime version

Python 3.10.3

OS info

ProductName: macOS
ProductVersion: 12.3.1
BuildVersion: 21E258
Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000

Steps to reproduce:

        Message(
            text="placeholder",
            blocks=[
                SectionBlock(
                    text="placeholder",
                    accessory=OverflowMenuElement(
                        options=[Option(value="placeholder", text="placeholder")]
                    ),
                )
            ],
        ).to_dict()

^ This will fail with slack_sdk.errors.SlackObjectFormationError: options attribute must have between 2 and 5 item

It used to be that the API required a minimum of two option entries in the overflow menu, but for a number of years now it has permitted just a single one.

Expected result:

No error is thrown and the object is converted to a dict.

Block kit builder screenshot to confirm that the API allows a single option:
image

{
	"blocks": [
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "This is a section block with an overflow menu with a single option."
			},
			"accessory": {
				"type": "overflow",
				"options": [
					{
						"text": {
							"type": "plain_text",
							"text": "A single option",
							"emoji": true
						}
					}
				]
			}
		}
	]
}

Actual result:

An error is thrown: slack_sdk.errors.SlackObjectFormationError: options attribute must have between 2 and 5 item

Metadata

Metadata

Assignees

No one assigned

    Labels

    Version: 3xbugM-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documentedweb-client

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions