The provided value is not part of ComboBox:

Hello Guys. I’m having this issue when binding a combobox. I’ve been dealing with it for hours. Any help will be highly appreciated.

//HERE IS THE EXCEPTION I’M GETTING

Caused by: java.lang.IllegalArgumentException: The provided value is not part of ComboBox: ADMINISTRATOR
at com.vaadin.flow.component.combobox.ComboBox.setValue(ComboBox.java:526)
at com.vaadin.flow.data.binder.Binder$BindingImpl.initFieldValue(Binder.java:1125)
at com.vaadin.flow.data.binder.Binder$BindingImpl.access$200(Binder.java:966)
at com.vaadin.flow.data.binder.Binder.lambda$readBean$2(Binder.java:1692)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at com.vaadin.flow.data.binder.Binder.readBean(Binder.java:1685)
at com.openitusa.simply5.ui.users.AddEditUser.initBehavior(AddEditUser.java:66)
at com.openitusa.simply5.ui.users.AddEditUser.(AddEditUser.java:55)

Here is part of the code

@Route(value = "AddEditUsers", layout = MainStreet.class)
public class AddEditUser extends VerticalScrollLayout implements HasUrlParameter<String>, BeforeEnterObserver	 {
	private H2 title = new H2("");
	private TextField userName = new TextField("Username");
	private PasswordField password = new PasswordField("Password");
	private TextField firstName = new TextField("First Name");
	private TextField lastName = new TextField("Last Name");
	private TextField email = new TextField("e-Mail");
	
	private ComboBox<Role> role = new ComboBox<>("User Role", RoleRepository.findAll());
	private ComboBox<Company> company = new ComboBox<>("Company", CompanyRepository.findAll());

	private Button cancel = new Button("Cancel");
	private Button save = new Button("Save", VaadinIcon.CHECK.create());
	private Button btnAddCompany = new Button("", VaadinIcon.PLUS.create());
	private Checkbox active = new Checkbox("Active");
    private Boolean editMode = false;
		
		public AddEditUser() {
			initLayout(title.getText());
			initBehavior(UserRepository.user);
		}

		private void initBehavior(User user) {
			
		    BeanValidationBinder<User> binder = new BeanValidationBinder<>(User.class);
            binder.bindInstanceFields(this);
			
            binder.readBean(user);	 **THE PROBLEM IS HERE AT THIS LINE WHEN THE BEAN IS READ **

            password.setValue("");
	        
            cancel.addClickListener(e -> {
            	UI.getCurrent().navigate(ViewUsers.class);	
            });
            
            save.addClickListener(e -> {
                try {
                    binder.validate();
                    binder.writeBean(user);
                    user.setPassword(AuthService.hashPassword(password.getValue()));
//                    user.setCompany(companies.getValue());
//                    user.setRole(roles.getValue());
                    UserRepository.save(user);
            //        close();
            //        refresh();
                    
                    Notification.show("The user has been saved");
                    UI.getCurrent().navigate(ViewUsers.class);
                    
                } catch (ValidationException ex) {
                    Notification.show("Please fix the errors and try again");
                }
            });
            
            btnAddCompany.addClickListener(addCompanyListener -> {
            company.setValue(CompanyRepository.findbyId(2L));
            });
		}

There’s a pair of issues that sound like they are related:
https://github.com/vaadin/vaadin-combo-box-flow/issues/43
which is closed, but reopened as:
https://github.com/vaadin/vaadin-combo-box-flow/issues/134