alibaba/open-code-review · error
resolve current input identity: %w
Error message
resolve current input identity: %w
What it means
validateResumeIdentity re-derives the input identity of the current invocation (via agent.ResolveIdentity) so it can be compared against the saved resume state. If identity resolution itself fails — e.g. the diff or git data cannot be recomputed — the error is wrapped as "resolve current input identity". It signals that a resume cannot even be validated, before any mismatch check runs.
Source
Thrown at cmd/opencodereview/review_cmd.go:395
// so a provider that changed via config file or environment stays implicit —
// which is the transition this check exists to reject.
func validateResumeIdentity(ctx context.Context, cc *commonContext, opts reviewOptions, rt *llmRuntime, state *session.ResumeState) (*agent.SealedInput, error) {
if state == nil {
return nil, nil
}
sealed, err := agent.ResolveIdentity(ctx, agent.Args{
RepoDir: cc.RepoDir,
From: opts.from,
To: opts.to,
Commit: opts.commit,
ReviewMode: reviewModeFromOptions(opts),
Template: *cc.Template,
SystemRule: cc.Resolver,
FileFilter: cc.FileFilter,
GitRunner: cc.GitRunner,
})
if err != nil {
return nil, fmt.Errorf("resolve current input identity: %w", err)
}
if err := state.ValidateResume(session.ResumeRequest{
Identity: sealed.Identity,
Provider: rt.Provider,
Model: rt.Model,
ProviderExplicit: opts.provider != "",
ModelExplicit: opts.model != "",
}); err != nil {
return nil, err
}
return sealed, nil
}
// fileReadRef picks the ref file_read resolves paths against.
//
// A sealed input replaces the ref the user typed with the commit that ref
// resolved to at admission. The diff under review is pinned to that same commit,
// so leaving the reader on a moving ref would let the model read one version of aView on GitHub (pinned to 5cf97d0d15)
Solutions
- Fix the underlying git/ref error reported by the wrapped %w cause (e.g. use refs that still resolve via `git rev-parse <ref>^{commit}`).
- Run `git status`/`git rev-parse --git-dir` in the repo to confirm the repository is intact before resuming.
- If the original inputs are gone, discard the resume state and start a fresh review instead of resuming.
Example fix
// before
ocr review --resume --from deleted-branch --to main
// after
git rev-parse --verify deleted-branch^{commit} # fails -> rebase happened
ocr review --from origin/main --to HEAD # fresh run instead of resume Defensive patterns
Strategy: validation
Validate before calling
if !gitRevParseOK(repoDir, from) || !gitRevParseOK(repoDir, to) {
return errors.New("resume refs no longer resolve; start a fresh review")
} Try / catch
sealed, err := validateResumeIdentity(ctx, cc, opts, rt, state)
if err != nil {
var mergeErr *session.IdentityMismatchError
if errors.As(err, &mergeErr) { /* prompt fresh run */ }
return fmt.Errorf("cannot resume: %w", err)
} Prevention
- Confirm resume refs still resolve (`git rev-parse <ref>^{commit}`) before resuming.
- Avoid rebasing/deleting branches referenced by an in-flight resume state.
- Run resume commands from the same repo/worktree as the original run.
When it happens
Trigger: Running `ocr review --resume` (validateResumeIdentity called from executeReviewContext or an anonymous runner) when agent.ResolveIdentity fails: bad --from/--to/--commit refs, git command failures, unreadable repo, or template/rule loading problems.
Common situations: Resuming a review after the branch or commits the resume state pointed at were rebased/deleted; running resume outside the original repo; broken git worktree.
Related errors
- load diffs: %w
- resolve commit %q
- resume rejected: repository identity changed, so this is not
- resume rejected: the reviewed input changed since session %q
- preview failed: %w
AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02).
Data as JSON: /api/errors/0fb21f9a8694eb5a.
Report an issue: GitHub.