{"record":{"id":"6a3846d047aaef3e","repo":"go-delve/delve","slug":"wrong-type-for-pcs-item-d-v","errorCode":null,"errorMessage":"wrong type for pcs item %d: %v","messagePattern":"wrong type for pcs item (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/variables.go","lineNumber":1118,"sourceCode":"\n// Stack returns the stack trace of ancestor 'a' as saved by the runtime.\nfunc (a *Ancestor) Stack(n int) ([]Stackframe, error) {\n\tif a.Unreadable != nil {\n\t\treturn nil, a.Unreadable\n\t}\n\tpcsVar := a.pcsVar.clone()\n\tpcsVar.loadValue(LoadConfig{MaxArrayValues: n})\n\tif pcsVar.Unreadable != nil {\n\t\treturn nil, pcsVar.Unreadable\n\t}\n\tr := make([]Stackframe, len(pcsVar.Children))\n\tfor i := range pcsVar.Children {\n\t\tif pcsVar.Children[i].Unreadable != nil {\n\t\t\tr[i] = Stackframe{Err: pcsVar.Children[i].Unreadable}\n\t\t\tcontinue\n\t\t}\n\t\tif pcsVar.Children[i].Kind != reflect.Uint {\n\t\t\treturn nil, fmt.Errorf(\"wrong type for pcs item %d: %v\", i, pcsVar.Children[i].Kind)\n\t\t}\n\t\tpc, _ := constant.Int64Val(pcsVar.Children[i].Value)\n\t\tfn := a.pcsVar.bi.PCToFunc(uint64(pc))\n\t\tif fn == nil {\n\t\t\tloc := Location{PC: uint64(pc)}\n\t\t\tr[i] = Stackframe{Current: loc, Call: loc}\n\t\t\tcontinue\n\t\t}\n\t\tpc2 := uint64(pc)\n\t\tif pc2-1 >= fn.Entry {\n\t\t\tpc2--\n\t\t}\n\t\tf, ln := fn.cu.lineInfo.PCToLine(fn.Entry, pc2)\n\t\tloc := Location{PC: uint64(pc), File: f, Line: ln, Fn: fn}\n\t\tr[i] = Stackframe{Current: loc, Call: loc}\n\t}\n\tr[len(r)-1].Bottom = pcsVar.Len == int64(len(pcsVar.Children))\n\treturn r, nil","sourceCodeStart":1100,"sourceCodeEnd":1136,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/variables.go#L1100-L1136","documentation":"When reconstructing a goroutine stack from the runtime's gp.pcs (or similar) slice, each element is expected to be a uintptr-like reflect.Uint value. If a child variable has any other Kind, the stack cannot be built and this error is thrown. It signals the pcs slice variable was decoded incorrectly or is corrupted.","triggerScenarios":"Goroutine stack extraction on a target where the pcs slice children were read as something other than unsigned ints (unreadable flag not set but Kind differs) — usually a DWARF layout mismatch or binary/ debugger version skew.","commonSituations":"Go runtime layout changes vs an outdated Delve version; debugging a binary built with a Go version newer than the Delve release supports.","solutions":["Upgrade Delve to a version matching the Go toolchain used to build the target (check Delve's supported Go versions).","Rebuild the target with a supported Go version and re-debug.","If it persists, report the failing variable Kind to go-delve/delve as a runtime layout mismatch."],"exampleFix":"// before\ngo install github.com/go-delve/delve/cmd/dlv@latest  # may lag Go tip\n\n// after: pin a Delve release matching your Go version\ngo install github.com/go-delve/delve/cmd/dlv@v1.22.0","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"frames, err := g.Stack(n, opts)\nif err != nil && strings.Contains(err.Error(), \"wrong type for pcs item\") {\n    // fall back to thread-based stack (Thread.Stacktrace) instead of goroutine pcs\n}","preventionTips":["Match Delve version to the target's Go toolchain version","Rebuild targets with Go versions supported by your Delve release","Report persistent mismatches upstream with Go and Delve versions"],"tags":["go","debugger","goroutines","stacktrace","version-mismatch"],"backgroundTag":"runtime-layout-mismatch","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}