Elm: Map.!: given key is not an element in the map

Hi, I’m porting some code to 0.19 and I stumbled on a problem I can’t figure out:

Here is my main, which was an Html.program:

main : Program () Model Msg
main =
  Browser.element
    {
      init = init,
      view = view,
      update = update,
      subscriptions = \_ -> Sub.none
    }

and I call it like this:

import Elm from '../SignUp'

document.addEventListener('DOMContentLoaded', () => {
  const target = document.getElementById('signin-form');
  var SignUp = Elm.Main.init({node: target, flags: {}});
});

This generates a very cryptic (IMHO) error that I’m not quite able to understand:

17:48:02 webpack.1 | ERROR in ./app/javascript/SignUp.elm
17:48:02 webpack.1 | Module build failed: Error: Compiler process exited with error  Compilation failed
Success! Compiled 1 module.
17:48:02 webpack.1 | elm: Map.!: given key is not an element in the map
17:48:02 webpack.1 | CallStack (from HasCallStack):

Can anybody figure out what’s happening?

TIA,
ngw

Depending on what’s happening in init, view and update and what the Model and Msg types are, the compiler run into problems. This happened a few times during the alpha testing period, it seems you’ve found another one.

Can you try and remove stuff from the app to get to the minimal code that still shows this bug? – ie, make a SSCCE – and share here or in the elm/compiler issues?

This error could be caused by data on disk that the compiler doesn’t understand or can’t cope with. You can try deleting the elm-stuff directory and recompiling; that might make the error disappear.

Just bumped into the same issue this morning. rm -rf elm-stuff solved the issue.

Done: Map.!: given key is not an element in the map · Issue #1796 · elm/compiler · GitHub

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.