(KeyError) key :kauflistens not found

After having changed the name of a table in schema from kauflistens to kauflistes and removed kauflistens everywhere I ran mix Ecto.migrate. Answer was the Migration is up. But of course it was not, the table name had not been changed in the database.
Therefore I changed the table name in the database manually. When now running the program I get an error output:

##### KeyError <small>at GET</small> <small>/</small>

# key :kauflistens not found in: %{conn: %Plug.Conn{adapter: {Plug.Cowboy.Conn, :...}, assigns: %{kauflistes: [%Einkaufsliste.Kauf.Kaufliste{__meta__: #Ecto.Schema.Metadata<:loaded, "kauflistes">, id: 3, inserted_at: ~N[2022-03-07 17:16:38], items: #Ecto.Association.NotLoaded<association :items is not loaded>, kaufdatum: "2022-03-11", updated_at: ~N[2022-03-07 17:47:04]},

Where should I look for an error?

You still have those structs around somewhere. Is this a live system or something you’re developing?

You probably should have renamed it in a migration, though renaming tables is not a popular thing to do. This guide should help.

1 Like

Thanks for the tips.
It is a small, simple system I am developing.
Yes, you were right, the struct was looming in a file,
~/…/einkaufsliste$ grep -Firl “kauflisten”
showed which files to inspect one time moore.
So the porblem is solved.