Skip to content

Getting "file not found" error for external package interfaces with v3 but not v2 #1151

@takanuva15

Description

@takanuva15

Description

I'm trying to migrate our mockery config from v2 to v3. Here's my v2 config:

dir: "test/mocks/{{.InterfaceDirRelative}}"
filename: "{{.InterfaceNameSnake}}_mock.go"
mockname: "{{.InterfaceName}}Mock"
include-auto-generated: false
packages:
  mockery3pkggen:
    config:
      all: true
  github.com/stevenferrer/solr-go:
    config:
      all: true
      recursive: true

And here's what mockery3 generated via mockery migrate in .mockery_v3.yml:

dir: test/mocks/{{.InterfaceDirRelative}}
include-auto-generated: false
structname: '{{.InterfaceName}}Mock'
template: testify
template-data:
  unroll-variadic: true
packages:
  github.com/stevenferrer/solr-go:
    config:
      all: true
      recursive: true
  mockery3pkggen:
    config:
      all: true

After running mockery3 --config .mockery_v3.yml, I just get this error:

$ mockery3 --config .mockery_v3.yml 
2026-04-01T17:30:44.482480000-04:00 INF Starting mockery config-file=.mockery_v3.yml version=v3.7.0
2026-04-01T17:30:44.482567000-04:00 INF Parsing configured packages... version=v3.7.0
2026-04-01T17:30:44.793681000-04:00 INF Done parsing configured packages. version=v3.7.0
2026-04-01T17:30:44.794416000-04:00 INF adding interface to collection collection=../go/pkg/mod/github.com/stevenferrer/[email protected]/mocks_test.go interface=Client package-path=github.com/stevenferrer/solr-go version=v3.7.0
2026-04-01T17:30:44.794512000-04:00 INF adding interface to collection collection=../go/pkg/mod/github.com/stevenferrer/[email protected]/mocks_test.go interface=Faceter package-path=github.com/stevenferrer/solr-go version=v3.7.0
2026-04-01T17:30:44.794593000-04:00 INF adding interface to collection collection=../go/pkg/mod/github.com/stevenferrer/[email protected]/mocks_test.go interface=QueryParser package-path=github.com/stevenferrer/solr-go version=v3.7.0
2026-04-01T17:30:44.794673000-04:00 INF adding interface to collection collection=../go/pkg/mod/github.com/stevenferrer/[email protected]/mocks_test.go interface=RequestSender package-path=github.com/stevenferrer/solr-go version=v3.7.0
2026-04-01T17:30:44.795657000-04:00 ERR failed to find output package path error="file not found" file=../go/pkg/mod/github.com/stevenferrer/[email protected]/mocks_test.go out-pkg-name=solr outPkgFSPath=/Users/myuser/Documents/Repositories/go/pkg/mod/github.com/stevenferrer/[email protected] src-pkg-name=solr srcPkgFSPath=/Users/myuser/go/pkg/mod/github.com/stevenferrer/[email protected] version=v3.7.0                                                                                                                                                                                                                                       
2026-04-01T17:30:44.795671000-04:00 FTL app failed error="file not found" version=v3.7.0

The v2 file works fine with mockery2 and generates the interfaces without error, so I'm confused what's wrong?

Reproducer

  1. Clone https://github.com/takanuva15/mockery3pkggen-error-mve
  2. Generate interfaces using mockery v2: mockery
  3. Generate interfaces using mockery v3 and observe error: mockery3 --config .mockery_v3.yml

Expected behavior

No error

Mockery version

v3.7.0

Installation Mechanism

  • go get
  • Pre-built release
  • homebrew
  • Other: [please describe]

Go version

go version go1.26.0 darwin/arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions