Callback doesn't see new target ID

Hi all! there was a problem with which I could not handle it myself … If I change the ID of the object to which I return the child object through the callback, then the callback does not see the new ID and throws an error that it cannot find the object with the old ID

  dbc.Col(
      html.Div(# id='x12',
               id='test',
               style={
                   'padding-bottom': '1%',
                   'padding-left': '1%',

               }
      ),
      style={
          'padding-bottom': '1%',
          'padding-left': '1%'
      },
      width=2
  )
[23/Mar/2022:22:46:34] ENGINE Bus STARTING
[23/Mar/2022:22:46:34] ENGINE Serving on http://192.168.100.101:8099
[23/Mar/2022:22:46:34] ENGINE Bus STARTED
Exception on /_dash-update-component [POST]
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\dash\dash.py", line 1306, in dispatch
    cb = self.callback_map[output]
KeyError: 'x12.children'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\ProgramData\Anaconda3\lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\ProgramData\Anaconda3\lib\site-packages\flask\app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\ProgramData\Anaconda3\lib\site-packages\dash\dash.py", line 1344, in dispatch
    raise KeyError(msg.format(output)) from missing_callback_function
KeyError: "Callback function not found for output 'x12.children', perhaps you forgot to prepend the '@'?"
Exception on /_dash-update-component [POST]
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\dash\dash.py", line 1306, in dispatch
    cb = self.callback_map[output]
KeyError: 'x12.children'

why it happens?

thanks for the help

Hi @Masya,
Modifying IDs within the app is not best practice. Can you please show more of the code. What are you trying to accomplish exactly?

Hi @adamschroeder ! during development I changed some IDs but the callbacks were called by the old names, I went back to dash 2.1 and the error was gone)

1 Like