{"record":{"id":"5a7a1518d5c10df3","repo":"golang/go","slug":"unknown-debug-key-s","errorCode":null,"errorMessage":"unknown debug key %s\n","messagePattern":"unknown debug key (.+?)\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/objabi/flag.go","lineNumber":447,"sourceCode":"\t\t\t// e.g. -d=ssa/generic_cse/time\n\t\t\t// _ in phase name also matches space\n\t\t\tphase := name[4:]\n\t\t\tflag := \"debug\" // default flag is debug\n\t\t\tif i := strings.Index(phase, \"/\"); i >= 0 {\n\t\t\t\tflag = phase[i+1:]\n\t\t\t\tphase = phase[:i]\n\t\t\t}\n\t\t\terr := f.debugSSA(phase, flag, val, valstring)\n\t\t\tif err != \"\" {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t\t// Setting this false for -d=ssa/... preserves old behavior\n\t\t\t// of turning off concurrency for any debug flags.\n\t\t\t// It's not known for sure if this is necessary, but it is safe.\n\t\t\t*f.concurrentOk = false\n\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"unknown debug key %s\\n\", name)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nconst debugHelpHeader = `usage: -d arg[,arg]* and arg is <key>[=<value>]\n\n<key> is one of:\n\n`\n\nfunc (f *DebugFlag) String() string {\n\treturn \"\"\n}\n","sourceCodeStart":429,"sourceCodeEnd":463,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/objabi/flag.go#L429-L463","documentation":"The Go compiler and linker accept `-d` flags for internal debug controls (e.g., `-d=panic`, `-d=nil`, `-d=wb`, `-d=ssa/...`). The flag parser looks up each key in a debug table (`f.tab`) or checks for the `ssa/` prefix for SSA-phase debugging. If neither matches, this error is returned, indicating the debug key name is not recognized by this build of the toolchain.","triggerScenarios":"Passing `-d=unknownkey` to `go build`, `go tool compile`, or `go tool link`. Using a debug key that exists in a different Go version but not in the one currently installed. Misspelling a known debug key like `-d=saa/generic_cse` instead of `-d=ssa/generic_cse`.","commonSituations":"Following outdated documentation or blog posts that reference debug keys removed in newer Go versions. Typing a debug key name. Running a newer Go toolchain with flags from an older one, or vice versa. Trying to use a compiler debug key on the linker (the two have different debug tables).","solutions":["Run `go tool compile -d help` or `go tool link -d help` to list valid debug keys for your toolchain version.","Correct any typos in the key name (e.g., `ssa` not `saa`).","Ensure you are using the key with the correct tool — compiler keys differ from linker keys.","Upgrade or downgrade Go to the version whose debug keys you need."],"exampleFix":"// before\n$ go build -gcflags=\"-d=saa/generic_cse/time\" ./...\n\n// after\n$ go build -gcflags=\"-d=ssa/generic_cse/time\" ./...\n\n// list valid keys\n$ go tool compile -d help","handlingStrategy":"validation","validationCode":"// List valid debug keys before using them\nfunc getValidDebugKeys(tool string) ([]string, error) {\n    cmd := exec.Command(tool, \"-d\", \"help\")\n    out, err := cmd.CombinedOutput()\n    if err != nil {\n        return nil, err\n    }\n    var keys []string\n    for _, line := range strings.Split(string(out), \"\\n\") {\n        line = strings.TrimSpace(line)\n        if line != \"\" && !strings.HasPrefix(line, \"usage\") {\n            keys = append(keys, line)\n        }\n    }\n    return keys, nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run 'go tool compile -d help' or 'go tool link -d help' to list valid keys.","Do not copy -d flags from documentation for a different Go version.","Double-check spelling of debug keys, especially ssa/ phase names."],"tags":["debug-flags","compiler","linker","command-line"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}