lib: Return an error from operations that require an upgrade