{"record":{"id":"ebad83f824c3dfa7","repo":"GoogleContainerTools/skaffold","slug":"unable-to-get-value-for-key-q-w","errorCode":null,"errorMessage":"unable to get value for key %q: %w","messagePattern":"unable to get value for key %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/util/env_template.go","lineNumber":106,"sourceCode":"\treturn EvaluateEnvTemplateMapWithEnv(args, nil)\n}\n\n// EvaluateEnvTemplateMapWithEnv parses and executes all map values as templates based on OS and custom environment variables\nfunc EvaluateEnvTemplateMapWithEnv(args map[string]*string, env map[string]string) (map[string]*string, error) {\n\tif args == nil {\n\t\treturn nil, nil\n\t}\n\n\tevaluated := map[string]*string{}\n\tfor k, v := range args {\n\t\tif v == nil {\n\t\t\tevaluated[k] = nil\n\t\t\tcontinue\n\t\t}\n\n\t\tvalue, err := ExpandEnvTemplate(*v, env)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to get value for key %q: %w\", k, err)\n\t\t}\n\n\t\tevaluated[k] = &value\n\t}\n\n\treturn evaluated, nil\n}\n\n// MapToFlag parses all map values and returns them as `key=value` with the given flag\n// Example: --my-flag key0=value0 --my-flag key1=value1  --my-flag key2=value2\nfunc MapToFlag(m map[string]*string, flag string) ([]string, error) {\n\tkv, err := EvaluateEnvTemplateMap(m)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to evaluate build args: %w\", err)\n\t}\n\n\tvar keys []string\n\tfor k := range kv {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/util/env_template.go#L88-L124","documentation":"EvaluateEnvTemplateMapWithEnv expands every map value as an env template against the given env map. This error means one value (identified by key k) failed ExpandEnvTemplate — either bad template syntax or a bad value — and it aborts evaluating the whole map. The key name and inner error are wrapped.","triggerScenarios":"ExpandEnvTemplate(*v, env) errors for a key in the map: value contains invalid {{...}} syntax (e.g. build args like '{{.FOO' with a missing brace) or ParseEnvTemplate rejects the string.","commonSituations":"skaffold.yaml buildArgs / artifacts fields where one entry has malformed Go-template syntax; mixing ${VAR} shell syntax where {{.VAR}} is expected; values copied from Helm charts with different templating engines.","solutions":["Check the specific key named in the error and fix its template syntax in skaffold.yaml.","Ensure Go-template syntax {{.KEY}} rather than shell ${KEY} or {{KEY}}.","Test the value standalone: util.ExpandEnvTemplate(value, os.Environ-as-map).","Run 'skaffold diagnose' to surface all template issues at once."],"exampleFix":"// before\nbuildArgs:\n  TAG: {{.GIT_TAG\n// after\nbuildArgs:\n  TAG: \"{{.GIT_TAG}}\"","handlingStrategy":"validation","validationCode":"for k, v := range m {\n    if v != nil && !isValidEnvTemplate(*v) {\n        return fmt.Errorf(\"key %q has invalid template %q\", k, *v)\n    }\n}","typeGuard":"func allValuesAreValidTemplates(m map[string]*string) bool {\n    for _, v := range m {\n        if v != nil && !isValidEnvTemplate(*v) { return false }\n    }\n    return true\n}","tryCatchPattern":"evaled, err := util.EvaluateEnvTemplateMap(m)\nif err != nil {\n    // error message names the offending key via %q\n    var key string\n    fmt.Sscanf(err.Error(), \"unable to get value for key %q\", &key)\n    return fmt.Errorf(\"fix template under key %s\", key)\n}","preventionTips":["Lint each map value as a Go template before passing the map","Use {{.VAR}} syntax consistently, never ${VAR} in these fields","Iterate map entries individually during debugging to isolate the bad key"],"tags":["templating","go-templates","config","build-args"],"backgroundTag":"template-parse-error","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}