Skip to content

Clearing the number input in mo.ui.slider(include_input=True) element causes UIElement's onchange handler error #6555

@stephenlf

Description

@stephenlf

Describe the bug

Setup: before the error.

Image

After the error

Image

Stack trace

Traceback (most recent call last):
  File ".../.venv/lib/python3.13/site-packages/marimo/_runtime/runtime.py", line 1785, in set_ui_element_value
    component._update(value)
    ~~~~~~~~~~~~~~~~~^^^^^^^
  File ".../.venv/lib/python3.13/site-packages/marimo/_plugins/ui/_core/ui_element.py", line 456, in _update
    self._value = self._convert_value(value)
                  ~~~~~~~~~~~~~~~~~~~^^^^^^^
  File ".../.venv/lib/python3.13/site-packages/marimo/_plugins/ui/_impl/input.py", line 365, in _convert_value
    return cast(Numeric, self._dtype(value))
                         ~~~~~~~~~~~^^^^^^^
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'


An exception was raised by a UIElement's on_change handler:

Will you submit a PR?

  • Yes

Environment

{
  "marimo": "0.16.2",
  "editable": false,
  "location": "/data/ems/stephens-notebooks/.venv/lib/python3.13/site-packages/marimo",
  "OS": "Linux",
  "OS Version": "6.8.0-84-generic",
  "Processor": "x86_64",
  "Python Version": "3.13.1",
  "Locale": "en_US",
  "Binaries": {
    "Browser": "--",
    "Node": "v22.16.0"
  },
  "Dependencies": {
    "click": "8.3.0",
    "docutils": "0.22.2",
    "itsdangerous": "2.2.0",
    "jedi": "0.19.2",
    "markdown": "3.9",
    "narwhals": "2.5.0",
    "packaging": "25.0",
    "psutil": "7.1.0",
    "pygments": "2.19.2",
    "pymdown-extensions": "10.16.1",
    "pyyaml": "6.0.3",
    "starlette": "0.48.0",
    "tomlkit": "0.13.3",
    "typing-extensions": "4.15.0",
    "uvicorn": "0.35.0",
    "websockets": "15.0.1"
  },
  "Optional Dependencies": {
    "duckdb": "1.4.0",
    "polars": "1.33.1",
    "pyarrow": "21.0.0",
    "loro": "1.8.1",
    "sqlglot": "27.19.0"
  },
  "Experimental Flags": {}
}

Code to reproduce

import marimo as mo
mo.ui.slider(start=0, stop=10, step=1, include_input=True)

In the UI, clear out the value of the number input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions