# "Transaction numbers are only allowed on a replica set member or mongos"

This error means the driver connected directly to one mongod and bypassed replica set semantics. Transactions need the replica set (or mongos).

## Confirm

1. Check the connection string for `directConnection=true`. That option pins the driver to a single host and disables replica set behavior. It is the usual culprit.
2. Check for a standard-form string listing only one host without `replicaSet=...`.
3. Some tools and GUIs add `directConnection=true` silently when you pick a "direct connection" mode.

## Fix

Remove `directConnection=true` and, for standard-form strings, include the full host list plus `replicaSet=[name]`. The SRV string handles this automatically. Keep `retryWrites=true`.

## Verify

Run a trivial multi-document transaction (insert two docs, commit). Success proves replica set semantics are back.