# go: ambiguous import: found package X in multiple modules: github.com/foo/bar and github.com/baz/bar

- **ID:** `go/go-mod-tidy-ambiguous-import`
- **Domain:** go
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 82%

## Root Cause

Two different modules provide the same import path, causing ambiguity in the module resolution.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| go1.21 | active | — | — |
| go1.22 | active | — | — |

## Workarounds

1. **Use a replace directive in go.mod to force one module: replace github.com/foo/bar => github.com/foo/bar v1.2.3** (90% success)
   ```
   Use a replace directive in go.mod to force one module: replace github.com/foo/bar => github.com/foo/bar v1.2.3
   ```
2. **Rename one of the conflicting packages or use a different import path by vendoring.** (75% success)
   ```
   Rename one of the conflicting packages or use a different import path by vendoring.
   ```

## Dead Ends

- **Running go mod tidy repeatedly hoping it resolves** — go mod tidy cannot resolve ambiguity; it requires manual intervention to specify which module to use. (95% fail)
- **Deleting go.sum and re-running go mod download** — Deleting go.sum doesn't fix the import path conflict; it only removes checksums. (80% fail)
