An "ambiguous import" error occurs when two different packages with the same import path are found in your module's dependency tree. To fix it, identify the conflicting versions and ensure your go.mod file specifies a single, consistent version for that package.
go mod tidy
If the error persists after running go mod tidy, check your go.mod file for multiple require lines pointing to the same package path but different versions, or look for a replace directive that might be causing a conflict. Manually edit go.mod to keep only the desired version and remove the conflicting entry, then run go mod tidy again.