{"record":{"id":"7547543bdccef143","repo":"alibaba/open-code-review","slug":"invalid-boolean-for-telemetry-enabled-w","errorCode":null,"errorMessage":"invalid boolean for telemetry.enabled: %w","messagePattern":"invalid boolean for telemetry\\.enabled: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/opencodereview/config_cmd.go","lineNumber":572,"sourceCode":"\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid boolean for llm.use_anthropic: %w\", err)\n\t\t}\n\t\tcfg.Llm.UseAnthropic = &b\n\t\t// Mirror protocol for backward compatibility. true always selects\n\t\t// anthropic. false only mirrors to the legacy openai default when\n\t\t// protocol is unset or already a legacy value (anthropic/openai);\n\t\t// openai-responses is preserved to avoid a silent downgrade.\n\t\tif b {\n\t\t\tcfg.Llm.Protocol = llm.ProtocolAnthropic\n\t\t} else if cfg.Llm.Protocol == \"\" || cfg.Llm.Protocol == llm.ProtocolAnthropic || cfg.Llm.Protocol == llm.ProtocolOpenAIChatCompletions {\n\t\t\tcfg.Llm.Protocol = llm.ProtocolOpenAIChatCompletions\n\t\t}\n\tcase \"language\", \"Language\":\n\t\tcfg.Language = value\n\tcase \"telemetry.enabled\", \"telemetry.Enabled\":\n\t\tb, err := strconv.ParseBool(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid boolean for telemetry.enabled: %w\", err)\n\t\t}\n\t\tcfg.ensureTelemetry()\n\t\tcfg.Telemetry.Enabled = b\n\tcase \"telemetry.exporter\", \"telemetry.Exporter\":\n\t\tcfg.ensureTelemetry()\n\t\tcfg.Telemetry.Exporter = value\n\tcase \"telemetry.otlp_endpoint\", \"telemetry.OTLPEndpoint\":\n\t\tcfg.ensureTelemetry()\n\t\tcfg.Telemetry.OTLPEndpoint = value\n\tcase \"telemetry.content_logging\", \"telemetry.ContentLog\":\n\t\tb, err := strconv.ParseBool(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid boolean for telemetry.content_logging: %w\", err)\n\t\t}\n\t\tcfg.ensureTelemetry()\n\t\tcfg.Telemetry.ContentLog = b\n\tcase \"llm.extra_body\", \"llm.ExtraBody\":\n\t\tvar m map[string]any","sourceCodeStart":554,"sourceCodeEnd":590,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/cmd/opencodereview/config_cmd.go#L554-L590","documentation":"Raised when the value for `ocr config set telemetry.enabled` (or telemetry.Enable) is not a boolean Go can parse (strconv.ParseBool accepts 1/t/T/true/TRUE/True/0/f/F/false/FALSE/False). The telemetry struct's Enabled field is a plain bool, so any other string would silently fail to be stored; the setter converts the parse error into a wrapped, user-facing error naming the key.","triggerScenarios":"`ocr config set telemetry.enabled <value>` where value is not one of 1/t/true/0/f/false (e.g. \"yes\", \"on\", \"enable\", empty).","commonSituations":"Disabling telemetry with \"no\"; an empty CI variable interpolated into the command; locale or YAML-style \"Y\"/\"N\" values.","solutions":["Run `ocr config set telemetry.enabled false` (or true)","Use 1/0 if scripting: `ocr config set telemetry.enabled 0`","Verify the value in CI pipelines isn't an unset variable expanding to empty string","Check other telemetry settings with `ocr config get`"],"exampleFix":"// before\nocr config set telemetry.enabled $TELEMETRY  # expands to empty\n// after\nocr config set telemetry.enabled \"${TELEMETRY:-false}\"","handlingStrategy":"validation","validationCode":"if _, err := strconv.ParseBool(v); err != nil {\n    return fmt.Errorf(\"telemetry.enabled must be true/false, got %q\", v)\n}\n_ = runConfigSet(\"telemetry.enabled\", v)","typeGuard":null,"tryCatchPattern":"if err := runConfigSet(\"telemetry.enabled\", v); err != nil {\n    if strings.Contains(err.Error(), \"invalid boolean for telemetry.enabled\") {\n        fmt.Fprintf(os.Stderr, \"pass true/false; got %q\\n\", v)\n    }\n}","preventionTips":["Use \"true\"/\"false\" literally in scripts; avoid YAML-style yes/no","Guard CI variables: \"${TELEMETRY_ENABLED:-false}\" so empty never reaches the CLI","Parse user input with strconv.ParseBool before passing through","Confirm the setting with `ocr config get`"],"tags":["config","telemetry","boolean","cli"],"backgroundTag":"invalid-boolean-value","analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}