{"record":{"id":"82f6441f94010b81","repo":"plandex-ai/plandex","slug":"both-target-and-current-states-must-be-provided","errorCode":null,"errorMessage":"both target and current states must be provided","messagePattern":"both target and current states must be provided","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/rewind.go","lineNumber":109,"sourceCode":"\t}\n\n\treturn affectedPaths\n}\n\n// RewindAnalysis captures all the information about a potential rewind operation\ntype RewindAnalysis struct {\n\t// Files that need to be modified when rewinding from current plan state to target plan state\n\tRequiredChanges map[string]string\n\t// Files that have been modified on disk relative to current plan state (potential conflicts)\n\tConflicts map[string]bool\n}\n\n// AnalyzeRewind examines the three states (disk, current plan, target plan) to determine:\n// 1. What files need to be changed to reach target state\n// 2. Which of those changes would conflict with user modifications\nfunc AnalyzeRewind(targetState, currentState *shared.CurrentPlanState) (*RewindAnalysis, error) {\n\tif targetState == nil || currentState == nil {\n\t\treturn nil, fmt.Errorf(\"both target and current states must be provided\")\n\t}\n\n\t// First determine what files need to be changed between current and target plan states\n\trequiredChanges := make(map[string]string)\n\n\t// Track all paths we need to examine for either changes or conflicts\n\tallPaths := make(map[string]bool)\n\n\t// Add paths from both states\n\tfor path, context := range targetState.ContextsByPath {\n\t\tif context.ContextType != shared.ContextFileType {\n\t\t\tcontinue\n\t\t}\n\t\tallPaths[path] = true\n\t}\n\tfor path, context := range currentState.ContextsByPath {\n\t\tif context.ContextType != shared.ContextFileType {\n\t\t\tcontinue","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/rewind.go#L91-L127","documentation":"Validation guard at the top of AnalyzeRewind: rewind requires both a target plan state and a current plan state to compute the diff of files to change. One or both were empty/nil, so the rewind cannot be analyzed.","triggerScenarios":"Thrown at app/cli/lib/rewind.go:109 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass both current and target plan states to AnalyzeRewind","Ensure the target branch/commit exists and has readable state","Reject the rewind early in the CLI before analysis"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}