{"record":{"id":"13ed3875271465ef","repo":"quasarframework/quasar","slug":"no-valid-env-prefix-specified-in-the-array-using","errorCode":null,"errorMessage":"No valid env prefix specified in the array, using default \"${defaultPrefix}\" instead.","messagePattern":"No valid env prefix specified in the array, using default \"(.+?)\" instead\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app-vite/lib/utils/env.js","lineNumber":99,"sourceCode":"        `Invalid env prefix \"${entry}\" specified in the array. Skipping it.`,\n        banner\n      )\n      continue\n    }\n\n    validPrefixList.push(entry)\n  }\n\n  if (validPrefixList.length === 0) {\n    if (!defaultPrefix) {\n      warn(\n        `No valid env prefix specified in the array. Allowing all env keys that are valid in JS (without any prefix).`,\n        banner\n      )\n      return ''\n    }\n\n    warn(\n      `No valid env prefix specified in the array, using default \"${defaultPrefix}\" instead.`,\n      banner\n    )\n    return defaultPrefix\n  }\n\n  return validPrefixList\n}\n\nfunction convertFileToArray(value) {\n  if (Array.isArray(value)) return value\n  return typeof value === 'string' ? [value] : []\n}\n\nfunction convertFolderToArray(value, appDir) {\n  if (Array.isArray(value)) return value.length !== 0 ? value : [appDir]\n  return typeof value === 'string' ? [value] : [appDir]\n}","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/quasarframework/quasar/blob/4841521b5f635a971eb9e2710e5542efd194691b/app-vite/lib/utils/env.js#L81-L117","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (quasar.config)\nbuild: { envFilesPrefix: ['my-app-env', '2nd-prefix'] }\n// after\nbuild: { envFilesPrefix: ['MY_APP_ENV', 'SECOND_PREFIX'] }","handlingStrategy":"validation","validationCode":"const identifiers = (cfg.build?.envFilesPrefix ?? []).filter(p => typeof p === 'string' && /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(p));\nif (identifiers.length === 0) throw new Error('envFilesPrefix has no valid JS identifiers');","typeGuard":"const isValidPrefix = (p) => typeof p === 'string' && /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(p);","tryCatchPattern":null,"preventionTips":["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."],"tags":["env","configuration","validation"],"backgroundTag":"invalid-env-prefix","analyzedSha":"4841521b5f635a971eb9e2710e5542efd194691b","analyzedAt":"2026-08-30T01:13:14.944Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}