{"record":{"id":"05e1ef82dd9c0ee1","repo":"pulumi/pulumi","slug":"failed-to-get-config-value-for-key-q-w","errorCode":null,"errorMessage":"failed to get config value for key %q: %w","messagePattern":"failed to get config value for key %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/autonaming/pattern.go","lineNumber":46,"sourceCode":"\tStack        string\n}\n\n// stackPatternEval is a helper struct for resolving stack-level expressions in autonaming patterns.\n// It's used to resolve ${organization}, ${project}, ${stack}, and ${config.key} expressions in patterns.\n// These are all expressions that can be resolved at startup time because they don't depend\n// on the resource URN.\ntype stackPatternEval struct {\n\tctx            StackContext\n\tgetConfigValue func(key string) (string, error)\n}\n\n// newStackPatternEval creates a new stack pattern evaluator based on the given stack and configuration.\nfunc newStackPatternEval(s StackContext, cfg config.Map, decrypter config.Decrypter,\n) *stackPatternEval {\n\tgetConfigValue := func(key string) (string, error) {\n\t\tc, ok, err := cfg.Get(config.MustMakeKey(s.Project, key), true)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to get config value for key %q: %w\", key, err)\n\t\t}\n\t\tif !ok {\n\t\t\treturn \"\", fmt.Errorf(\"no value found for key %q\", key)\n\t\t}\n\t\tv, err := c.Value(decrypter)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"failed to decrypt value for key %q: %w\", key, err)\n\t\t}\n\t\treturn v, nil\n\t}\n\treturn &stackPatternEval{\n\t\tctx:            s,\n\t\tgetConfigValue: getConfigValue,\n\t}\n}\n\nvar configRegex = regexp.MustCompile(`\\${config\\.([^}]+)}`)\n","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/autonaming/pattern.go#L28-L64","documentation":"Inside newStackPatternEval, the getConfigValue callback resolves a config key referenced from an autonaming pattern via cfg.Get(config.MustMakeKey(s.Project, key), true). This error is thrown when that Get returns an error (as opposed to the separate 'no value found for key' error when the key is absent), wrapping the underlying config access failure.","triggerScenarios":"An autonaming pattern contains ${config.<key>} and the underlying cfg.Get call errors while fetching that project-scoped key — e.g. malformed config map state or failure reading the key.","commonSituations":"Corrupted Pulumi.<stack>.yaml or project config; keys referenced across stacks/projects where lookup machinery fails; secret decryption plumbing issues surfacing at Get time.","solutions":["Check the wrapped cause for the underlying config access problem","Verify the referenced key loads via `pulumi config get <key>`","Repair or regenerate the malformed Pulumi.<stack>.yaml","Remove the ${config.*} reference from the pattern (use a literal) to unblock"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify pattern-referenced keys are retrievable before deploy:\npulumi config get <patternKey> >/dev/null || echo \"pattern key missing or unreadable\"","typeGuard":null,"tryCatchPattern":"// Go caller:\nautonamer, err := ParseAutonamingConfig(s, cfg, decrypter)\nif err != nil && strings.Contains(err.Error(), \"failed to get config value for key\") {\n    // %q names the key whose Get failed; inspect the wrapped cause\n    return err\n}","preventionTips":["Reference only config keys defined in the same project/stack","Repair malformed Pulumi.<stack>.yaml promptly","Prefer literal segments in patterns over many ${config.*} lookups"],"tags":["pulumi","config","pattern","autonaming"],"backgroundTag":"config-load-failure","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}