What causes a Failed to execute 'fetch' on 'ServiceWorkerGlobalScope': 'only-if-cached' can be set only with 'same-origin' mode error?

I believe this is a Chromium bug that has been reported here. Hopefully it will be fixed soon or some more information about the issue will be published.

Paul Irish implemented a temporary work around, which is as follows:

if (e.request.cache === 'only-if-cached' && e.request.mode !== 'same-origin') {
  return;
}

I ran it inside the callback for the service worker install and fetch listeners and it prevented the error.

You can see the full commit of Paul's code here.