quasarframework/quasar · warning

No valid env prefix specified in the array. Allowing all env

Error message

No valid env prefix specified in the array. Allowing all env keys that are valid in JS (without any prefix).

What it means

After filtering an env.prefix array, if no entry survived validation (all empty or invalid) and no defaultPrefix exists, getEnvFilesPrefix warns and returns '' — meaning all JS-valid env keys are exposed without any prefix, since there is no usable filter.

Source

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

  const validPrefixList = []
  for (const entry of prefix) {
    if (!entry) continue

    if (!validEnvKeyRE.test(entry)) {
      warn(
        `Invalid env prefix "${entry}" specified in the array. Skipping it.`,
        banner
      )
      continue
    }

    validPrefixList.push(entry)
  }

  if (validPrefixList.length === 0) {
    if (!defaultPrefix) {
      warn(
        `No valid env prefix specified in the array. Allowing all env keys that are valid in JS (without any prefix).`,
        banner
      )
      return ''
    }

    warn(
      `No valid env prefix specified in the array, using default "${defaultPrefix}" instead.`,
      banner
    )
    return defaultPrefix
  }

  return validPrefixList
}

function convertFileToArray(value) {
  if (Array.isArray(value)) return value

View on GitHub (pinned to 4841521b5f)

Solutions

  1. Add at least one valid prefix entry (valid JS identifier) to the array.
  2. If exposing everything is intended, replace the array with prefix: '' or remove the option and document the choice.
  3. Verify .env variable naming matches the final prefix decision.

Example fix

// before (quasar.config)
env: { prefix: ['a-b_', ''] }
// after
env: { prefix: ['MYAPP_', 'CLIENT1_'] }
Defensive patterns

Strategy: validation

Validate before calling

const validEnvKeyRE = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/
const list = conf.env?.prefix
if (Array.isArray(list) && !list.some(e => e && validEnvKeyRE.test(e))) {
  throw new Error('env.prefix array has no valid entries')
}

Type guard

function hasValidPrefixEntry(v) {
  return Array.isArray(v) && v.some(e => typeof e === 'string' && /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e))
}

Prevention

When it happens

Trigger: quasar dev/build with env.prefix as an array whose entries are all falsy or all fail validEnvKeyRE (e.g. prefix: ['x-y_', '']) and defaultPrefix is '' (backendPrefix default); called from prefix/clientPrefix/backendPrefix getters.

Common situations: Every entry mistyped with invalid characters, an array of empty strings, or config edited down to invalid placeholders during debugging.

Related errors


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