{"id":"28bb048b285e2eb4","repo":"docker/cli","slug":"invalid-env-file-s-v","errorCode":null,"errorMessage":"invalid env file (%s): %v","messagePattern":"invalid env file \\((.+?)\\): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/kvfile/kvfile.go","lineNumber":66,"sourceCode":"\t\"os\"\n\t\"strings\"\n\t\"unicode\"\n\t\"unicode/utf8\"\n)\n\n// Parse parses a line-delimited key/value pairs separated by equal sign.\n// It accepts a lookupFn to lookup default values for keys that do not define\n// a value. An error is produced if parsing failed, the content contains invalid\n// UTF-8 characters, or a key contains whitespaces.\nfunc Parse(filename string, lookupFn func(key string) (value string, found bool)) ([]string, error) {\n\tfh, err := os.Open(filename)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tout, err := parseKeyValueFile(fh, lookupFn)\n\t_ = fh.Close()\n\tif err != nil {\n\t\treturn []string{}, fmt.Errorf(\"invalid env file (%s): %v\", filename, err)\n\t}\n\treturn out, nil\n}\n\n// ParseFromReader parses a line-delimited key/value pairs separated by equal sign.\n// It accepts a lookupFn to lookup default values for keys that do not define\n// a value. An error is produced if parsing failed, the content contains invalid\n// UTF-8 characters, or a key contains whitespaces.\nfunc ParseFromReader(r io.Reader, lookupFn func(key string) (value string, found bool)) ([]string, error) {\n\treturn parseKeyValueFile(r, lookupFn)\n}\n\nconst whiteSpaces = \" \\t\"\n\nfunc parseKeyValueFile(r io.Reader, lookupFn func(string) (string, bool)) ([]string, error) {\n\tlines := []string{}\n\tscanner := bufio.NewScanner(r)\n\tutf8bom := []byte{0xEF, 0xBB, 0xBF}","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/pkg/kvfile/kvfile.go#L48-L84","documentation":"Error \"invalid env file (%s): %v\" thrown in docker/cli.","triggerScenarios":"Thrown at pkg/kvfile/kvfile.go:66 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}