{"record":{"id":"cba8db77fcddde7d","repo":"pulumi/pulumi","slug":"validating-stack-config-w-cba8db","errorCode":null,"errorMessage":"validating stack config: %w","messagePattern":"validating stack config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/neo/tools/pulumi.go","lineNumber":275,"sourceCode":"\tif err != nil {\n\t\treturn failedResult(a, \"\", fmt.Errorf(\"getting stack: %w\", err))\n\t}\n\tif s == nil {\n\t\treturn failedResult(a, \"\", fmt.Errorf(\"stack %q not found\", a.StackName))\n\t}\n\n\tssml := cmdStack.NewStackSecretsManagerLoaderFromEnv()\n\tcfg, sm, err := cmdConfig.GetStackConfiguration(ctx, cmdutil.Diag(), ssml, s, proj, \"\", nil)\n\tif err != nil {\n\t\treturn failedResult(a, \"\", fmt.Errorf(\"getting stack configuration: %w\", err))\n\t}\n\n\tdecrypter := sm.Decrypter()\n\tencrypter := sm.Encrypter()\n\tif err := pkgWorkspace.ValidateStackConfigAndApplyProjectConfig(\n\t\tctx, s.Ref().Name().String(), proj, cfg.Environment, cfg.Config, encrypter, decrypter,\n\t); err != nil {\n\t\treturn failedResult(a, \"\", fmt.Errorf(\"validating stack config: %w\", err))\n\t}\n\n\tautonamer, err := autonaming.ParseAutonamingConfig(\n\t\tautonamingStackContextFor(proj, s), cfg.Config, decrypter)\n\tif err != nil {\n\t\treturn failedResult(a, \"\", fmt.Errorf(\"getting autonaming config: %w\", err))\n\t}\n\n\t// Pass nil for flags: GetUpdateMetadata only uses them to record\n\t// \"pulumi.flag.<name>\" entries, and Neo has no CLI flags to record.\n\tm, err := metadata.GetUpdateMetadata(\"\" /*message*/, root,\n\t\t\"neo\" /*execKind*/, \"\" /*execAgent*/, false /*updatePlan*/, cfg, nil)\n\tif err != nil {\n\t\treturn failedResult(a, \"\", fmt.Errorf(\"gathering metadata: %w\", err))\n\t}\n\n\topts := backend.UpdateOptions{\n\t\tAutoApprove: true, // Upstream approval already gates pulumi_up before dispatch.","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/neo/tools/pulumi.go#L257-L293","documentation":"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.","triggerScenarios":"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.","commonSituations":"`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.","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."],"exampleFix":"// before (Pulumi.dev.yaml)\nconfig:\n  aws:region: 42\n\n// after\nconfig:\n  aws:region: us-east-1","handlingStrategy":"validation","validationCode":"// dry-run config validation before the tool call\nconst { execSync } = require('child_process');\nexecSync('pulumi preview --expect-no-changes', { stdio: 'pipe', cwd: projDir }); // throws on schema/config violations","typeGuard":null,"tryCatchPattern":"try {\n  await neo.callTool('pulumi_up', args);\n} catch (e) {\n  if (/validating stack config:/.test(e.message)) {\n    console.error('Fix config per schema:', e.message.replace('validating stack config: ', ''));\n  }\n}","preventionTips":["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."],"tags":["config","validation","schema"],"backgroundTag":"stack-config-validation-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}