quasarframework/quasar · warning
No valid env prefix specified in the array, using default "$
Error message
No valid env prefix specified in the array, using default "${defaultPrefix}" instead. What it means
getEnvFilesPrefix validates the `envFilesPrefix` array (from quasar.config > build > envFilesPrefix) and falls back to a default prefix when none of the entries is a valid JS identifier. This warning is emitted instead of failing so builds keep working, but the user's intended prefix is ignored. It exists because Quasar needs a valid identifier to expose env keys in process.env on the client.
Source
Thrown at app-vite/lib/utils/env.js:99
`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
return typeof value === 'string' ? [value] : []
}
function convertFolderToArray(value, appDir) {
if (Array.isArray(value)) return value.length !== 0 ? value : [appDir]
return typeof value === 'string' ? [value] : [appDir]
}View on GitHub (pinned to 4841521b5f)
Solutions
- Use prefixes that are valid JS identifiers: letters, digits, underscore, not starting with a digit (e.g. ['MY_APP', 'VUE_APP']).
- If you intended to allow all env keys, pass an explicitly empty configuration path the library supports (the preceding branch returns '' with its own warning) rather than invalid entries.
- Re-run the dev/build command and confirm the warning no longer appears and process.env keys resolve in client code.
Example fix
// before (quasar.config)
build: { envFilesPrefix: ['my-app-env', '2nd-prefix'] }
// after
build: { envFilesPrefix: ['MY_APP_ENV', 'SECOND_PREFIX'] } Defensive patterns
Strategy: validation
Validate before calling
const identifiers = (cfg.build?.envFilesPrefix ?? []).filter(p => typeof p === 'string' && /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(p));
if (identifiers.length === 0) throw new Error('envFilesPrefix has no valid JS identifiers'); Type guard
const isValidPrefix = (p) => typeof p === 'string' && /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(p);
Prevention
- Only use prefixes matching /^[A-Za-z_$][A-Za-z0-9_$]*$/ (no dashes, no leading digits).
- Validate config prefixes in CI before running builds.
- Read the emitted warning output during dev runs; it names the fallback prefix.
When it happens
Trigger: Setting build.envFilesPrefix to an array containing only invalid JS identifiers (e.g. ['my-env', '123abc', 'with-dash']) or an array of non-string values; then calling getEnvFilesPrefix via prefix/clientPrefix/backendPrefix.
Common situations: Typos like dashes or leading digits in the prefix; copying a kebab-case env var name (APP-MY_KEY) into the config; passing process.env keys rather than the prefix portion.
Related errors
- Build output directory must be a non-empty path
- Project directory must be a non-empty path
- Invalid SSR nonce. Expected a non-empty base64 or base64url
- [Quasar] In your Vite config file, please add the Quasar plu
- Failed to open specific browser
AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30).
Data as JSON: /api/errors/13ed3875271465ef.
Report an issue: GitHub.