pulumi/pulumi · error
failed to get config value for key %q: %w
Error message
failed to get config value for key %q: %w
What it means
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.
Source
Thrown at pkg/cmd/pulumi/autonaming/pattern.go:46
Stack string
}
// stackPatternEval is a helper struct for resolving stack-level expressions in autonaming patterns.
// It's used to resolve ${organization}, ${project}, ${stack}, and ${config.key} expressions in patterns.
// These are all expressions that can be resolved at startup time because they don't depend
// on the resource URN.
type stackPatternEval struct {
ctx StackContext
getConfigValue func(key string) (string, error)
}
// newStackPatternEval creates a new stack pattern evaluator based on the given stack and configuration.
func newStackPatternEval(s StackContext, cfg config.Map, decrypter config.Decrypter,
) *stackPatternEval {
getConfigValue := func(key string) (string, error) {
c, ok, err := cfg.Get(config.MustMakeKey(s.Project, key), true)
if err != nil {
return "", fmt.Errorf("failed to get config value for key %q: %w", key, err)
}
if !ok {
return "", fmt.Errorf("no value found for key %q", key)
}
v, err := c.Value(decrypter)
if err != nil {
return "", fmt.Errorf("failed to decrypt value for key %q: %w", key, err)
}
return v, nil
}
return &stackPatternEval{
ctx: s,
getConfigValue: getConfigValue,
}
}
var configRegex = regexp.MustCompile(`\${config\.([^}]+)}`)
View on GitHub (pinned to 793f7b2e16)
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
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify pattern-referenced keys are retrievable before deploy: pulumi config get <patternKey> >/dev/null || echo "pattern key missing or unreadable"
Try / catch
// Go caller:
autonamer, err := ParseAutonamingConfig(s, cfg, decrypter)
if err != nil && strings.Contains(err.Error(), "failed to get config value for key") {
// %q names the key whose Get failed; inspect the wrapped cause
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Corrupted Pulumi.<stack>.yaml or project config; keys referenced across stacks/projects where lookup machinery fails; secret decryption plumbing issues surfacing at Get time.
Related errors
- failed to resolve root naming config: %w
- invalid autonaming config: %w
- failed to marshal autonaming config: %w
- invalid autonaming config structure: %w
- failed to get autonaming config: %w
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/05e1ef82dd9c0ee1.
Report an issue: GitHub.