pulumi/pulumi · error
validating stack config: %w
Error message
validating stack config: %w
What it means
Thrown when pkgWorkspace.ValidateStackConfigAndApplyProjectConfig rejects the stack's config after it was loaded: configuration values violate the schema (wrong types, unknown keys, missing required inputs) or project-level config constraints (allowed values, defaults) can't be applied.
Source
Thrown at pkg/cmd/pulumi/neo/tools/pulumi.go:275
if err != nil {
return failedResult(a, "", fmt.Errorf("getting stack: %w", err))
}
if s == nil {
return failedResult(a, "", fmt.Errorf("stack %q not found", a.StackName))
}
ssml := cmdStack.NewStackSecretsManagerLoaderFromEnv()
cfg, sm, err := cmdConfig.GetStackConfiguration(ctx, cmdutil.Diag(), ssml, s, proj, "", nil)
if err != nil {
return failedResult(a, "", fmt.Errorf("getting stack configuration: %w", err))
}
decrypter := sm.Decrypter()
encrypter := sm.Encrypter()
if err := pkgWorkspace.ValidateStackConfigAndApplyProjectConfig(
ctx, s.Ref().Name().String(), proj, cfg.Environment, cfg.Config, encrypter, decrypter,
); err != nil {
return failedResult(a, "", fmt.Errorf("validating stack config: %w", err))
}
autonamer, err := autonaming.ParseAutonamingConfig(
autonamingStackContextFor(proj, s), cfg.Config, decrypter)
if err != nil {
return failedResult(a, "", fmt.Errorf("getting autonaming config: %w", err))
}
// Pass nil for flags: GetUpdateMetadata only uses them to record
// "pulumi.flag.<name>" entries, and Neo has no CLI flags to record.
m, err := metadata.GetUpdateMetadata("" /*message*/, root,
"neo" /*execKind*/, "" /*execAgent*/, false /*updatePlan*/, cfg, nil)
if err != nil {
return failedResult(a, "", fmt.Errorf("gathering metadata: %w", err))
}
opts := backend.UpdateOptions{
AutoApprove: true, // Upstream approval already gates pulumi_up before dispatch.View on GitHub (pinned to 793f7b2e16)
Solutions
- Run `pulumi config` / `pulumi up --dry-run` locally to see the exact validation message, then fix the offending key in Pulumi.<stack>.yaml.
- Add the missing key declaration (with correct type) to the `config:` section of Pulumi.yaml, or delete the undeclared key from stack config.
- Supply values for required config keys with `pulumi config set <key> <value>` (use --secret as needed).
- Align value types — quote numbers/bools or use the correct JSON type per the schema.
Example fix
// before (Pulumi.dev.yaml) config: aws:region: 42 // after config: aws:region: us-east-1
Defensive patterns
Strategy: validation
Validate before calling
// dry-run config validation before the tool call
const { execSync } = require('child_process');
execSync('pulumi preview --expect-no-changes', { stdio: 'pipe', cwd: projDir }); // throws on schema/config violations Try / catch
try {
await neo.callTool('pulumi_up', args);
} catch (e) {
if (/validating stack config:/.test(e.message)) {
console.error('Fix config per schema:', e.message.replace('validating stack config: ', ''));
}
} Prevention
- Declare every config key with a type in Pulumi.yaml's `config:` section.
- Set values with `pulumi config set` rather than hand-editing stack yaml.
- Run a local `pulumi preview` after any provider upgrade or config change.
When it happens
Trigger: Calling pulumi_preview/pulumi_up when a stack config value has the wrong type for its declared type in Pulumi.yaml (e.g. string where a number is required), a config key isn't declared in the project, a required config value is missing, or an environment-injected value conflicts with project constraints.
Common situations: `pulumi config set aws:region us-east-1` typed values that need typed objects; removing a config type declaration from Pulumi.yaml while stack yaml still sets the key; upgrading a provider whose config schema added required fields; environments (Pulumi Cloud) returning values of the wrong shape.
Related errors
- invalid empty stack name
- refusing to remove stack because it still contains resources
- a stack named %s already exists
- writing snapshot: %w
- saving update info: %w
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/cba8db77fcddde7d.
Report an issue: GitHub.