{"record":{"id":"0085e0d53477276f","repo":"docker/cli","slug":"s-parsing-q-w","errorCode":null,"errorMessage":"%s: parsing %q: %w","messagePattern":"(.+?): parsing %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/context/options.go","lineNumber":74,"sourceCode":"\t\t\tdescription: \"Path to TLS key file\",\n\t\t},\n\t\t{\n\t\t\tname:        keySkipTLSVerify,\n\t\t\tdescription: \"Skip TLS certificate validation\",\n\t\t},\n\t}\n)\n\nfunc parseBool(config map[string]string, name string) (bool, error) {\n\tstrVal, ok := config[name]\n\tif !ok {\n\t\treturn false, nil\n\t}\n\tres, err := strconv.ParseBool(strVal)\n\tif err != nil {\n\t\tvar nErr *strconv.NumError\n\t\tif errors.As(err, &nErr) {\n\t\t\treturn res, fmt.Errorf(\"%s: parsing %q: %w\", name, nErr.Num, nErr.Err)\n\t\t}\n\t\treturn res, fmt.Errorf(\"%s: %w\", name, err)\n\t}\n\treturn res, nil\n}\n\nfunc validateConfig(config map[string]string, allowedKeys map[string]struct{}) error {\n\tvar errs []error\n\tfor k := range config {\n\t\tif _, ok := allowedKeys[k]; !ok {\n\t\t\terrs = append(errs, errors.New(\"unrecognized config key: \"+k))\n\t\t}\n\t}\n\treturn errors.Join(errs...)\n}\n\nfunc getDockerEndpoint(contextStore store.Reader, config map[string]string) (docker.Endpoint, error) {\n\tif err := validateConfig(config, allowedDockerConfigKeys); err != nil {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/context/options.go#L56-L92","documentation":"Thrown by parseBool when strconv.ParseBool fails and the error is a *strconv.NumError (the common path). It formats '<key>: parsing \"<value>\": <reason>'. Affected keys are mainly skip-tls-verify passed through the --docker flag during context creation.","triggerScenarios":"Passing `--docker skip-tls-verify=foo` (or yes/maybe/1.0) to docker context create. strconv.ParseBool only accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False.","commonSituations":"Using 'yes'/'no' instead of 'true'/'false'; using an integer other than 0/1; quoting or trailing whitespace; locale-induced values.","solutions":["Use a Go-accepted bool literal: true/false or 1/0","For skip-tls-verify, use --docker skip-tls-verify=true (or =1)","Remove whitespace/quotes around the value"],"exampleFix":"# before\ndocker context create ctx --docker host=tcp://h:2376,skip-tls-verify=yes\n# after\ndocker context create ctx --docker host=tcp://h:2376,skip-tls-verify=true","handlingStrategy":"validation","validationCode":"// Normalize bool values before passing them to --docker.\nfunc parseBoolStrict(s string) (bool, error) {\n    switch strings.ToLower(strings.TrimSpace(s)) {\n    case \"1\", \"true\", \"t\":\n        return true, nil\n    case \"0\", \"false\", \"f\":\n        return false, nil\n    }\n    return false, fmt.Errorf(\"invalid bool %q\", s)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict boolean inputs to true/false in templates","Reject yes/no at the form/UI layer"],"tags":["docker","context","bool-parse","tls","validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}