get_terms() returns Trying to get property of non-object error for custom taxonomy

The error message is pretty clear: Invalid taxonomy..

You’re hooking to init to register your custom taxonomy, however you’re calling get_terms( 'type' ) right away, before init is fired and therefore before your taxonomy is registered.

You can’t call get_terms( 'type' ) before init.