quasarframework/quasar · warning
Invalid env prefix specified, using default "${defaultPrefix
Error message
Invalid env prefix specified, using default "${defaultPrefix}" instead. What it means
Same invalid-single-string-prefix case as the no-default variant, but here a defaultPrefix exists: the invalid configured prefix is discarded and the default (e.g. 'QCLI_') is used instead, after warning. The invalid prefix never takes effect.
Source
Thrown at app-vite/lib/utils/env.js:65
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.`,
banner
)
return defaultPrefix
}
return prefix
}
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
)View on GitHub (pinned to 4841521b5f)
Solutions
- Correct the prefix to a valid JS identifier in quasar.config > env.
- If the default prefix is fine, delete the invalid prefix option and accept the (info-level) default warning.
- Grep .env files and rename variables to the corrected or default prefix.
Example fix
// before (quasar.config)
env: { prefix: 'app-env_' }
// after
env: { prefix: 'APP_ENV_' } Defensive patterns
Strategy: validation
Validate before calling
const validEnvKeyRE = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/
const p = conf.env?.prefix
if (typeof p === 'string' && p && !validEnvKeyRE.test(p)) {
console.warn(`env.prefix "${p}" invalid; falling back to default 'QCLI_'`)
} Type guard
function isValidEnvPrefix(v) {
return typeof v === 'string' && /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(v)
} Prevention
- Test the prefix against /^[a-zA-Z_$][a-zA-Z0-9_$]*$/ before committing config.
- Remember the fallback default is 'QCLI_' for client builds; rename .env vars accordingly if you rely on defaults.
When it happens
Trigger: quasar dev/build with env.prefix (or clientPrefix/backendPrefix source) set to a string failing /^[a-zA-Z_$][a-zA-Z0-9_$]*$/ while the caller has a defaultPrefix; getEnvFilesPrefix falls back to it.
Common situations: Typos like 'q-cli_' vs 'QCLI_', hyphenated team prefixes, or forgetting prefixes must be valid JS identifier starts.
Related errors
- The "${prefix}" env prefix is invalid in JS. Allowing all en
- No env prefix specified, using default "${defaultPrefix}" in
- Invalid env prefix "${entry}" specified in the array. Skippi
- No valid env prefix specified in the array. Allowing all env
- Build output directory must be a non-empty path
AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30).
Data as JSON: /api/errors/a13e31bbdb493495.
Report an issue: GitHub.