{"record":{"id":"58995910d3a6e3d3","repo":"larksuite/cli","slug":"invalid-s-q-want-true-false-1-0","errorCode":null,"errorMessage":"invalid %s %q (want true/false/1/0)","messagePattern":"invalid (.+?) %q \\(want true/false/1/0\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/transport/config.go","lineNumber":183,"sourceCode":"}\n\n// parseBoolEnv accepts common boolean spellings used in environment variables.\nfunc parseBoolEnv(name, raw string) (bool, error) {\n\ts := strings.TrimSpace(strings.ToLower(raw))\n\tif s == \"\" {\n\t\t// Treat empty as false when explicitly present.\n\t\treturn false, nil\n\t}\n\tswitch s {\n\tcase \"1\", \"true\", \"on\", \"yes\", \"y\":\n\t\treturn true, nil\n\tcase \"0\", \"false\", \"off\", \"no\", \"n\":\n\t\treturn false, nil\n\t}\n\tif b, err := strconv.ParseBool(s); err == nil {\n\t\treturn b, nil\n\t}\n\treturn false, fmt.Errorf(\"invalid %s %q (want true/false/1/0)\", name, raw)\n}\n\n// proxyURL validates the fixed configured proxy configuration and returns its URL.\nfunc (c *Config) proxyURL() (*url.URL, error) {\n\traw := strings.TrimSpace(c.Proxy)\n\tif raw == \"\" {\n\t\treturn nil, fmt.Errorf(\"%s is empty\", envvars.CliProxyAddress)\n\t}\n\tredacted := redactProxyURL(raw)\n\tu, err := url.Parse(raw)\n\tif err != nil {\n\t\t// Do not wrap the raw url.Parse error: its string embeds the original\n\t\t// URL, which can contain userinfo (user:password). Return a redacted,\n\t\t// generic message instead.\n\t\treturn nil, fmt.Errorf(\"invalid %s %q: malformed URL\", envvars.CliProxyAddress, redacted)\n\t}\n\tif u.Scheme != \"http\" {\n\t\treturn nil, fmt.Errorf(\"invalid %s %q: scheme must be http\", envvars.CliProxyAddress, redacted)","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/transport/config.go#L165-L201","documentation":"parseBoolEnv parses LARKSUITE_CLI_PROXY_ENABLE. Accepted spellings (case-insensitive, trimmed): empty, 1/true/on/yes/y and 0/false/off/no/n, plus anything strconv.ParseBool accepts (t/f/T/F/TRUE/FALSE). Anything else makes transport setup fail with this error naming the env var and raw value.","triggerScenarios":"Setting LARKSUITE_CLI_PROXY_ENABLE to a non-boolean value — e.g. `export LARKSUITE_CLI_PROXY_ENABLE=enabled`, `=2`, `=TRUE ` with a non-trimmed character like a tab, `=\"true\"` with literal quotes, or a localized word (`=vrai`, `=ja`) — then running any CLI command.","commonSituations":"Copy-pasting a shell snippet where quotes became part of the value; shell profiles exporting words like \"yes please\" or \"enabled\"; CI templates using 2/yes-but-typoed values; YAML/JSON boolean literals pasted verbatim into an export.","solutions":["Set the variable to a recognized boolean: `export LARKSUITE_CLI_PROXY_ENABLE=true` (or 1/on/yes/y) or false/0/off/no/n.","Check for stray characters: `echo \"[$LARKSUITE_CLI_PROXY_ENABLE]\"` to spot quotes, spaces, or CR (Windows line endings) — unset and re-export a clean value.","If the value should be off, `unset LARKSUITE_CLI_PROXY_ENABLE` or set it to 0.","Remove the bad export from ~/.bashrc, ~/.zshrc, or CI env config so it doesn't recur."],"exampleFix":"// before\nexport LARKSUITE_CLI_PROXY_ENABLE=enabled\n// after\nexport LARKSUITE_CLI_PROXY_ENABLE=true","handlingStrategy":"validation","validationCode":"v=\"$LARKSUITE_CLI_PROXY_ENABLE\"\ncase \"${v,,}\" in ''|1|true|on|yes|y|0|false|off|no|n) echo \"OK: $v\" ;; *) echo \"BAD value for LARKSUITE_CLI_PROXY_ENABLE: $v\" >&2; exit 1 ;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use 1/true/on/yes/y or 0/false/off/no/n for LARKSUITE_CLI_PROXY_ENABLE.","Check shell startup files and CI env blocks for stray exports of this variable.","Guard against copy-paste artifacts: echo \"[$LARKSUITE_CLI_PROXY_ENABLE]\" to see hidden quotes/CR characters.","Prefer 1/0 — unambiguous and shell-safe."],"tags":["environment","config","boolean-parsing","proxy"],"backgroundTag":"invalid-env-var-value","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}