Get the wrapped error with errors.Unwrap:
wrapped := fmt.Errorf("outer: %w", inner)
original := errors.Unwrap(wrapped)
Usually you'll use errors.Is or errors.As instead of unwrapping manually. They search the entire chain for you. Manual unwrapping is rarely needed.