Action is unknown to this NavController

In my case, I was trying to navigate from fragment A to fragment B, but fragment A was not navigated to via the nav controller (aka, not present in the navigation graph), it was a fragment that I explicitly initialized initialized from a FragmentStateAdater (tied to a ViewPager). The solution was to create a global action to fragment B, instead of one from fragment A to fragment B


You calling twice to 'Navigation.findNavController(view).navigate':

private void makeTransfer(View view) {
    Bundle bundle = new Bundle();
    bundle.putString("name", "Aleksey");
    Navigation.findNavController(view).navigate(R.id.transferAction, bundle);

    //Type safe passing data 
    InitialFragmentDirections.TransferAction action = InitialFragmentDirections.transferAction();
    action.setLastName("Petrov");
    Navigation.findNavController(view).navigate(action);
} 

First time with bundle and second time with safe args, but after the first call your destination already changed to 'nextFragment', and when you call second 'navigate' the 'NavController' looking for 'transferAction' action inside 'nextFragment' and throws exception.