quasarframework/quasar · info

No env prefix specified, using default "${defaultPrefix}" in

Error message

No env prefix specified, using default "${defaultPrefix}" instead.

What it means

getEnvFilesPrefix resolves which prefix filters which .env files' variables are exposed. When the configured prefix is falsy (undefined/empty) but the caller supplies a defaultPrefix, it warns and falls back to that default instead of silently exposing nothing.

Source

Thrown at app-vite/lib/utils/env.js:48

/**
 * Filter out keys that cannot be used in JS
 * as import.meta.env.[key]
 * Examples: ProgramFiles(x86), BASH_FUNC_which%%
 *
 * Also, avoid sub-deps changing process.env, resulting
 * in restarts of the devserver watching for config changes...
 */
const processEnv = Object.keys(process.env)
  .filter(key => validEnvKeyRE.test(key))
  .reduce((acc, key) => {
    acc[key] = process.env[key]
    return acc
  }, {})

function getEnvFilesPrefix({ prefix, defaultPrefix, banner }) {
  if (!prefix) {
    if (!defaultPrefix) return ''
    warn(
      `No env prefix specified, using default "${defaultPrefix}" instead.`,
      banner
    )
    return defaultPrefix
  }

  if (!Array.isArray(prefix)) {
    if (!validEnvKeyRE.test(prefix)) {
      if (!defaultPrefix) {
        warn(
          `The "${prefix}" env prefix is invalid in JS. Allowing all env keys that are valid in JS (without any prefix).`,
          banner
        )
        return ''
      }

      warn(
        `Invalid env prefix specified, using default "${defaultPrefix}" instead.`,

View on GitHub (pinned to 4841521b5f)

Solutions

  1. Set quasar.config > env > prefix explicitly (e.g. prefix: 'MY_APP_') to silence the warning and control exposure.
  2. If the default is acceptable, no action needed — it is informational only.
  3. To expose nothing, set prefix to a non-empty unlikely string rather than empty.

Example fix

// before (quasar.config)
env: { prefix: undefined }
// after
env: { prefix: 'MYAPP_' }
Defensive patterns

Strategy: validation

Validate before calling

// in quasar.config
if (!conf.env?.prefix) console.warn('env.prefix not set; default prefix will be used')

Type guard

function hasEnvPrefix(conf) {
  return typeof conf?.env?.prefix === 'string' && conf.env.prefix.length > 0 || Array.isArray(conf?.env?.prefix)
}

Prevention

When it happens

Trigger: quasar dev/build when quasar.config > env > prefix is omitted/empty while a default prefix applies (e.g. client builds defaulting to 'QCLI_'); getEnvFilesPrefix is called by the prefix, clientPrefix and backendPrefix getters.

Common situations: Upgrading Quasar where env prefix handling changed, deleting the env prefix option while relying on old behavior, or a typo like prefix: '' meaning to disable it.

Related errors


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