{"record":{"id":"e8ff072980c0146e","repo":"GoogleContainerTools/skaffold","slug":"invalid-env-variable-format-s-should-be-key-val","errorCode":null,"errorMessage":"invalid env variable format: %s, should be KEY=VALUE","messagePattern":"invalid env variable format: (.+?), should be KEY=VALUE","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/schema/profiles.go","lineNumber":209,"sourceCode":"\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tkubeContext, err := isKubeContext(cond.KubeContext, opts)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn command && env && kubeContext, nil\n}\n\nfunc isEnv(env string) (bool, error) {\n\tif env == \"\" {\n\t\treturn true, nil\n\t}\n\n\tkeyValue := strings.SplitN(env, \"=\", 2)\n\tif len(keyValue) != 2 {\n\t\treturn false, fmt.Errorf(\"invalid env variable format: %s, should be KEY=VALUE\", env)\n\t}\n\n\tkey := keyValue[0]\n\tvalue := keyValue[1]\n\n\tenvValue := os.Getenv(key)\n\n\t// Special case, since otherwise the regex substring check (`re.Compile(\"\").MatchString(envValue)`)\n\t// would always match which is most probably not what the user wanted.\n\tif value == \"\" {\n\t\treturn envValue == \"\", nil\n\t}\n\n\treturn skutil.RegexEqual(value, envValue), nil\n}\n\nfunc isCommand(command string, opts cfg.SkaffoldOptions) bool {\n\tif command == \"\" {","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/schema/profiles.go#L191-L227","documentation":"Profile auto-activation can be driven by environment variables via `profiles.activation.env`. `isEnv` (pkg/skaffold/schema/profiles.go:209) parses each env value and requires the literal form KEY=VALUE. If the configured value contains no `=` at all, SplitN yields one element and the activation evaluation cannot proceed, so it returns this error.","triggerScenarios":"skaffold.yaml contains a profile activation `env:` entry that is a bare name like `env: CI` or `env: DEBUG_MODE` instead of `env: CI=true`. It is evaluated whenever profile auto-activation runs (activatedProfiles -> isProfileActivated -> isActivationTriggered -> isEnv) during ApplyProfiles.","commonSituations":"Hand-written skaffold.yaml where the author expected a bare variable name to mean 'env var is set'; copying Kubernetes-style env entries; YAML quoting mistakes that drop the `=VALUE` part; typos like `env: FOO BAR`.","solutions":["Change the activation entry to include a value: `env: CI=true` (or the desired value, e.g. `env: ENV=staging`)","If you only care whether the variable is set (to any value), use `env: CI=` style per skaffold docs semantics or list each KEY=VALUE pair explicitly","Validate skaffold.yaml with `skaffold diagnose` to catch malformed activation blocks before running"],"exampleFix":"# before\nprofiles:\n  - name: prod\n    activation:\n      - env: PROD\n# after\nprofiles:\n  - name: prod\n    activation:\n      - env: PROD=true","handlingStrategy":"validation","validationCode":"yq '.profiles[].activation[]?.env // empty' skaffold.yaml | grep -v '=' && echo 'must be KEY=VALUE'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write activation env entries as KEY=VALUE","Lint skaffold.yaml with skaffold diagnose in CI"],"tags":["configuration","environment-variables","schema"],"backgroundTag":"invalid-env-var-format","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"}