quasarframework/quasar · error

Workbox strategy "${cfg.pwa.workboxMode}" is invalid. Valid

Error message

Workbox strategy "${cfg.pwa.workboxMode}" is invalid. Valid quasar.config file > pwa > workboxMode options are: GenerateSW or InjectManifest. Please fix it.

What it means

During #computeConfig, the pwa.workboxMode value is checked against the two valid Workbox strategies: GenerateSW and InjectManifest. An invalid value is a fatal error in strict contexts (#shouldFail) and otherwise a warning that aborts the PWA service-worker configuration step.

Source

Thrown at app-vite/lib/quasar-config-file.js:1486

      cfg.pwa = merge(
        {
          workboxMode: 'GenerateSW',
          injectPWAMetaTags: true,
          swFilename: 'sw.js', // should be .js (as it's the distribution file, not the input file)
          manifestFilename: 'manifest.json',
          useCredentialsForManifestTag: false
        },
        cfg.pwa
      )

      if (!['GenerateSW', 'InjectManifest'].includes(cfg.pwa.workboxMode)) {
        const msg =
          `Workbox strategy "${cfg.pwa.workboxMode}" is invalid. ` +
          'Valid quasar.config file > pwa > workboxMode options are: GenerateSW or InjectManifest.'

        if (this.#shouldFail) fatal(msg, 'FAIL')

        warn(msg + ' Please fix it.\n')
        return
      }

      cfg.build.define['import.meta.env.QUASAR_SERVICE_WORKER_FILE'] =
        `"${cfg.build.publicPath}${cfg.pwa.swFilename}"`

      cfg.metaConf.pwaManifestFile = appPaths.resolve.app(
        cfg.sourceFiles.pwaManifestFile
      )

      cfg.sourceFiles.pwaServiceWorker = appPaths.resolve.app(
        cfg.sourceFiles.pwaServiceWorker
      )
    } else if (this.#ctx.mode.bex) {
      cfg.metaConf.bexManifestFile = appPaths.resolve.app(
        cfg.sourceFiles.bexManifestFile
      )
    }

View on GitHub (pinned to 4841521b5f)

Solutions

  1. Set pwa.workboxMode to exactly 'GenerateSW' or 'InjectManifest' in quasar.config.
  2. If you don't need a custom service worker, use 'GenerateSW'.
  3. If you maintain src-pwa/custom-service-worker.js, use 'InjectManifest'.

Example fix

// before (quasar.config)
pwa: { workboxMode: 'injectManifest' }
// after
pwa: { workboxMode: 'InjectManifest' }
Defensive patterns

Strategy: validation

Validate before calling

const modes = ['GenerateSW', 'InjectManifest']
const mode = cfg.pwa?.workboxMode
if (mode !== undefined && !modes.includes(mode)) {
  throw new Error(`pwa.workboxMode must be one of ${modes.join(' | ')}, got: ${mode}`)
}

Type guard

function isValidWorkboxMode(v) {
  return v === 'GenerateSW' || v === 'InjectManifest'
}

Prevention

When it happens

Trigger: quasar dev/build -m pwa with quasar.config > pwa > workboxMode set to anything other than 'GenerateSW' or 'InjectManifest' (typo, wrong casing like 'generatesw', or a stale value from older Quasar versions).

Common situations: Migrating from older Quasar CLI versions where other modes existed, copy-pasting config from outdated tutorials, or accidentally writing 'inject-manifest'.

Related errors


AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30). Data as JSON: /api/errors/b6ab33988cbd7b38. Report an issue: GitHub.