## TL;DR
Do not merge the same profile view twice: whylogs profile views are single-merge, so build a fresh view from the second profile or merge the underlying profiles before creating the view you merge. The error is raised when a DatasetProfileView that was already merged into another profile is merged again, a common slip when a reference profile is reused across comparisons.

```text
whylogs profiling failed error "ValueError: profile view already merged"
```

## Use this when
- The check or run fails with this symptom: whylogs profiling fails with ValueError profile view already merged.
- You are working on a whylogs workflow that merges profile views for drift or reference comparisons and the failure repeats on the same data or configuration.
- You need the failing rows, rule, or stage isolated before changing thresholds or code.

## Not for this skill when
- A first merge of two freshly created views, where the failure points at profile version skew instead of reuse.
- The error text names a different tool, stage, or root cause. Match the verbatim error first and use that skill.

## Steps
1. Trace the code path and find where the same view object is passed to a merge call more than once. Verify: the double merge call site is identified
2. Recreate the view from its profile for the second comparison instead of reusing the merged object. Verify: each comparison builds its own view
3. If several profiles must be combined, merge the profiles first and create one view from the result. Verify: the combined profile produces a single view
4. Rerun the profiling and comparison flow. Verify: all comparisons complete with no already merged error

## Variant phrasings
### whylogs profile view already merged ValueError
The shorter phrasing focused on the named failure.
### whylogs profiling failed profile view merged
The symptom phrasing a searcher tries next.
### whylogs merge profile view twice fix
The variant naming the failing stage or tool directly.

Compatibility: whylogs 1.x Python client, DatasetProfile and DatasetProfileView APIs

## Why it happens
Merging mutates the view state in whylogs to track that its data has been folded into another profile. The library raises instead of double-counting the same rows, because a silent second merge would corrupt every statistic in the combined profile.

## Edge cases / pitfalls
- Reusing a reference view across a loop of batch comparisons is the usual trigger; construct the reference view inside the loop.
- Serializing and reloading a view does not reset the merged flag reliably across versions; rebuild from the profile instead.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_Xx7YD8aezZa6yVhrGHCIig
