{"record":{"id":"8727b76686c92f3a","repo":"sveltejs/kit","slug":"env-static-private-is-deprecated-use-app-env","errorCode":null,"errorMessage":"`$env/static/private` is deprecated, use `$app/env/private` instead","messagePattern":"`\\$env/static/private` is deprecated, use `\\$app/env/private` instead","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/runtime/env/static/private.js","lineNumber":5,"sourceCode":"import { DEV } from 'esm-env';\nexport * from '../../app/env/private/index.js';\n\nif (DEV) {\n\tconsole.warn('`$env/static/private` is deprecated, use `$app/env/private` instead');\n}\n","sourceCodeStart":1,"sourceCodeEnd":7,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/env/static/private.js#L1-L7","documentation":"The `$env/static/private` module is deprecated in favor of `$app/env/private`. It statically re-exports all private environment variables and emits this DEV warning when imported. Variables remain statically inlined at build time; only the import location changed.","triggerScenarios":"Importing `import { SECRET_X } from '$env/static/private'` (or named imports generally) in server-only code during development.","commonSituations":"Server-only modules (hooks, endpoints, auth utilities) importing specific secret values via the old static module after upgrading SvelteKit to the version with `$app/env` modules.","solutions":["Change imports to `import { env } from '$app/env/private'` and access `env.SECRET_X`, or use `$app/env/private` equivalents for named imports","Update all server-only usages since static named imports from the old path will keep warning","Run a codemod/grep for `$env/static/private` across the repo"],"exampleFix":"// before\nimport { DATABASE_URL } from '$env/static/private';\n// after\nimport { env } from '$app/env/private';\nconst DATABASE_URL = env.DATABASE_URL;","handlingStrategy":"validation","validationCode":"import { env } from '$app/env/private'; // correct specifier\n// CI grep: ! grep -r \"\\$env/static/private\" src/","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Import private env via $app/env/private instead of static named imports","Keep secrets in server-only files and never import them client-side","Run repo-wide grep for $env/static/private in CI"],"tags":["deprecation","environment","env-variables","imports","sveltekit"],"backgroundTag":"deprecated-env-module","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}