{"record":{"id":"dcccecbd80815a28","repo":"go-delve/delve","slug":"not-a-recording","errorCode":null,"errorMessage":"not a recording","messagePattern":"not a recording","errorType":"exception","errorClass":"ErrNotRecorded","httpStatus":null,"severity":"error","filePath":"pkg/proc/target.go","lineNumber":21,"sourceCode":"import (\n\t\"errors\"\n\t\"fmt\"\n\t\"go/constant\"\n\t\"os\"\n\t\"sort\"\n\t\"strings\"\n\t\"sync\"\n\n\t\"github.com/go-delve/delve/pkg/dwarf/op\"\n\t\"github.com/go-delve/delve/pkg/goversion\"\n\t\"github.com/go-delve/delve/pkg/logflags\"\n\t\"github.com/go-delve/delve/pkg/proc/internal/ebpf\"\n)\n\nvar (\n\t// ErrNotRecorded is returned when an action is requested that is\n\t// only possible on recorded (traced) programs.\n\tErrNotRecorded = errors.New(\"not a recording\")\n\n\t// ErrNoRuntimeAllG is returned when the runtime.allg list could\n\t// not be found.\n\tErrNoRuntimeAllG = errors.New(\"could not find goroutine array\")\n\n\t// ErrProcessDetached indicates that we detached from the target process.\n\tErrProcessDetached = errors.New(\"detached from the process\")\n)\n\ntype LaunchFlags uint8\n\nconst (\n\tLaunchForeground LaunchFlags = 1 << iota\n\tLaunchDisableASLR\n)\n\n// Target represents the process being debugged.\ntype Target struct {","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/target.go#L3-L39","documentation":"ErrNotRecorded is the sentinel error returned by delve's proc layer when an action that only makes sense on a recorded (traced) program is requested on a live process. Recording-backed operations (reverse stepping, restarts, time travel) require the debugger to have captured execution history, which live backends do not have. The proc layer returns this sentinel so callers can detect the unsupported direction/mode explicitly.","triggerScenarios":"Calling TargetGroup.ChangeDirection (e.g. setting direction to Backward or issuing rev-step/rev-next) or Restart on a process attached via the native or gdbserial (live) backend, since dummyRecordingManipulation.Restart always returns ErrNotRecorded.","commonSituations":"A user issues 'rewind', 'restart' or reverse-continue in the terminal/DAP client while debugging a normal 'dlv debug'/'dlv attach' session instead of a 'dlv replay' core/trace recording; IDE plugins that expose reverse-debug buttons unconditionally.","solutions":["Only enable reverse-debugging operations when the session was launched from a recording (dlv replay / rr backend)","Check the backend/recording state before calling ChangeDirection or Restart","Handle the sentinel error by falling back to forward-only execution","Use `so`/forward stepping instead of reverse commands on live targets"],"exampleFix":"// before\ntgrp.ChangeDirection(proc.Backward) // panics flow with 'not a recording'\n// after\nif _, err := tgrp.Valid(); err == nil && debuggerIsRecording {\n    err = tgrp.ChangeDirection(proc.Backward)\n} else {\n    return fmt.Errorf(\"reverse stepping requires a recording (use dlv replay)\")\n}","handlingStrategy":"try-catch","validationCode":"// check session kind before reverse ops\nif !isRecordingSession(tgrp) {\n    return fmt.Errorf(\"reverse operations require a recorded target\")\n}","typeGuard":"func isRecordingSession(t *proc.TargetGroup) bool {\n    _, err := t.Valid()\n    return err == nil && t.Selected != nil && t.Selected.Recording() != nil\n}","tryCatchPattern":"err := tgrp.ChangeDirection(proc.Backward)\nif errors.Is(err, proc.ErrNotRecorded) {\n    // fall back to forward-only stepping\n}","preventionTips":["Only expose reverse-debug commands when launched via dlv replay/rr","Check recording support in UI before enabling rewind buttons","Treat ErrNotRecorded as a capability flag, not a failure"],"tags":["go","debugger","reverse-debugging","recording"],"backgroundTag":"operation-not-supported-on-live-target","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}