Skip to content

[BUG]: environment flag "..." must be defined within this schema when importing #428

Description

@bestickley

varlock version

0.4.2

Steps to reproduce

.env.schema

# @currentEnv=$DEPLOY_ENV
# @defaultSensitive=false
# @generateTypes(lang=ts, path=./src/env.d.ts, executeWhenImported=true)
# @import(
#   ../../../.env.schema,
#   AWS_ACCOUNT,
#   AWS_PROFILE,
#   AWS_REGION,
#   DEPLOY_ENV,
#   SHARED_INFRA_NAMESPACE,
# )
# ---
AUTH_TABLE_NAME=awsParam("/$SHARED_INFRA_NAMESPACE/$DEPLOY_ENV/auth-table-name")
CHAT_URL="http://localhost:8000/api/v1/chat"

What is expected?

success

What is actually happening?

error:

pnpm varlock load
🚨 Error encountered while loading .env.schema

environment flag "DEPLOY_ENV" must be defined within this schema

Stack trace:
Error: environment flag "DEPLOY_ENV" must be defined within this schema
    at DotEnvFileDataSource.finishInit (file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-PCRIVT4T.js:10166:30)
    at async DirectoryDataSource.addChild (file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-PCRIVT4T.js:10046:5)
    at async DirectoryDataSource.addAutoLoadedFile (file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-PCRIVT4T.js:10490:5)
    at async DirectoryDataSource._finishInit (file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-PCRIVT4T.js:10495:5)
    at async DirectoryDataSource.finishInit (file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-PCRIVT4T.js:10107:5)
    at async EnvGraph2.setRootDataSource (file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-PCRIVT4T.js:10866:5)
    at async loadEnvGraph (file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-NWY5IIPW.js:234:5)
    at async loadVarlockEnvGraph (file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-MBYYRBL6.js:6:20)
    at async Module.commandFn (file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-RQDMJMKL.js:53:20)
    at async executeCommand (file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-4A54P4EM.js:884:20)
file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-PCRIVT4T.js:11378
        if (!defaultSensitiveDec.decValueResolver) throw new Error("expected defaultSensitive to have a value resolver");
                                                         ^

Error: expected defaultSensitive to have a value resolver
    at ConfigItem.processSensitive (file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-PCRIVT4T.js:11378:58)
    at ConfigItem.resolve (file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-PCRIVT4T.js:11444:16)
    at async resolveItem (file:///Users/stickb/Code/census/llm-research/node_modules/.pnpm/varlock@0.4.2/node_modules/varlock/dist/chunk-PCRIVT4T.js:10972:9)

Node.js v24.10.0

System Info

npx envinfo --system --npmPackages
Need to install the following packages:
envinfo@7.21.0
Ok to proceed? (y) y


  System:
    OS: macOS 26.3.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 379.58 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  npmPackages:
    @ai-sdk/amazon-bedrock: catalog: => 3.0.87 
    @ai-sdk/provider: catalog: => 2.0.1 
    @ai-sdk/react: catalog: => 2.0.155 
    @aws-sdk/client-secrets-manager: catalog: => 3.1006.0 
    @aws-sdk/credential-providers: catalog: => 3.1006.0 
    @census/data-core: workspace:^ => 0.1.0 
    @census/shared-core: workspace:^ => 0.1.0 
    @census/shared-infra: workspace:^ => 0.1.0 
    @census/shared-web: workspace:^ => 0.1.0 
    @opensearch-project/opensearch: catalog: => 3.5.1 
    @radix-ui/react-slot: catalog: => 1.2.4 
    @radix-ui/react-tooltip: catalog: => 1.2.8 
    @radix-ui/react-use-controllable-state: catalog: => 1.2.2 
    @tailwindcss/postcss: catalog: => 4.2.1 
    @trussworks/react-uswds: catalog: => 10.2.0 
    @ts-rest/core: catalog: => 3.53.0-rc.1 
    @types/debug: catalog: => 4.1.12 
    @types/react: catalog: => 19.2.14 
    @types/react-dom: catalog: => 19.2.3 
    @uswds/uswds: catalog: => 3.13.0 
    ai: catalog: => 5.0.153 
    aws-cdk: catalog: => 2.1110.0 
    aws-cdk-lib: catalog: => 2.243.0 
    babel-plugin-react-compiler: catalog: => 19.1.0-rc.3 
    better-auth: catalog: => 1.5.4 
    cdk-nag: catalog: => 2.37.55 
    constructs: catalog: => 10.5.1 
    debug: catalog: => 4.4.3 
    drizzle-orm: catalog: => 0.44.7 
    lucide-react: catalog: => 0.542.0 
    next: catalog: => 16.1.6 
    next-themes: catalog: => 0.4.6 
    postcss: catalog: => 8.5.8 
    react: catalog: => 19.2.4 
    react-dom: catalog: => 19.2.4 
    recharts: catalog: => 3.8.0 
    remark-gfm: catalog: => 4.0.1 
    shiki: catalog: => 3.23.0 
    sonner: catalog: => 2.0.7 
    streamdown: catalog: => 1.6.11 
    tailwindcss: catalog: => 4.2.1 
    use-stick-to-bottom: catalog: => 1.1.3 
    vite-tsconfig-paths: catalog: => 5.1.4 
    zod: catalog: => 4.3.6

Any additional comments?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions