Consider the following example:

Manipulate[{1}[[i]], {i, {1 -> "a"}}]

Execute it and you'll get:

enter image description here

The correct result will be displayed if you select a from the popup menu, but the red box won't go away:

enter image description here

The issue doesn't raise if I build something similar in a lower level way:

DynamicModule[{x}, {PopupMenu[Dynamic@x, {1 -> "a"}], Dynamic@{1}[[x]]}]

enter image description here

What am I doing wrong here? Or it's a bug?

OK, it's not a bug. Here's the response from WRI:

Yes, the first implementation (this refers to my first code sample) is an inappropriate way of specifying a control in Manipulate.

Proper ways are shown in Kuba's comment and Chris Degnen's answer below.

  • $\begingroup$ Use Initialization, I wouldn't say controllers are responsible for initial values and logical content of body of Manipulate. It's user task to make it reasonable. $\endgroup$
    – Kuba
    Oct 11, 2015 at 21:53

1 Answer 1


Setting the initial value stops the error.

Manipulate[{1, 2}[[i]], {{i, 2}, {1 -> "a", 2 -> "b"}}]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.