{
  "id": "go/flag-redefined-panic",
  "signature": "panic: flag redefined: -verbose",
  "signature_zh": "panic: 标志重复定义：-verbose",
  "regex": "panic: flag redefined: -[a-zA-Z0-9_-]+",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Calling flag.String, flag.Int, or similar with a flag name that has already been registered in the same flag.CommandLine set.",
  "root_cause_type": "generic",
  "root_cause_zh": "使用已在同一 flag.CommandLine 集合中注册的标志名称调用 flag.String、flag.Int 或类似函数。",
  "versions": [
    {
      "version": "go1.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "go1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "go1.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "go1.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The default set is still used; panics persist unless all flags are on a custom set.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The flag name string is what matters; variable name change doesn't affect registration.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure each flag name is unique across the entire program: use descriptive prefixes like `-server-port` and `-client-port` instead of just `-port`.",
      "success_rate": 0.95,
      "how": "Ensure each flag name is unique across the entire program: use descriptive prefixes like `-server-port` and `-client-port` instead of just `-port`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use separate flag sets for different packages and parse each set independently: `fs := flag.NewFlagSet(\"myapp\", flag.ExitOnError); fs.String(\"verbose\", \"\", \"desc\")`",
      "success_rate": 0.9,
      "how": "Use separate flag sets for different packages and parse each set independently: `fs := flag.NewFlagSet(\"myapp\", flag.ExitOnError); fs.String(\"verbose\", \"\", \"desc\")`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Ensure each flag name is unique across the entire program: use descriptive prefixes like `-server-port` and `-client-port` instead of just `-port`.",
    "Use separate flag sets for different packages and parse each set independently: `fs := flag.NewFlagSet(\"myapp\", flag.ExitOnError); fs.String(\"verbose\", \"\", \"desc\")`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pkg.go.dev/flag#Var",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-11-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}