# go: github.com/foo/bar@v1.2.3: parsing go.mod:
	module declares its path as: github.com/foo/baz
	        but was required as: github.com/foo/bar

- **ID:** `go/module-declares-path-but-required-as`
- **Domain:** go
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The module's go.mod declares a different module path than the import path used. Common after a repo rename/fork without updating go.mod.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.16+ | active | — | — |
| 1.21+ | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   go mod edit -replace=github.com/foo/bar=github.com/foo/baz@v1.2.3
go mod tidy
   ```
2. **** (85% success)
   ```
   // in your fork's go.mod
module github.com/you/bar
// then: go mod edit -replace=github.com/foo/bar=github.com/you/bar@v0.0.0-<pseudo>
   ```

## Dead Ends

- **** — go.sum does not encode module path mapping; the error persists (95% fail)
- **** — GOPRIVATE only affects proxy/checksum behavior, not path validation (85% fail)
- **** — the source at that path may not exist or may be a different module (60% fail)
