{"record":{"id":"adece176b7550866","repo":"golang-migrate/migrate","slug":"expects-assetsource","errorCode":null,"errorMessage":"expects *AssetSource","messagePattern":"expects \\*AssetSource","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"source/go_bindata/go-bindata.go","lineNumber":41,"sourceCode":"\tAssetFunc AssetFunc\n}\n\nfunc init() {\n\tsource.Register(\"go-bindata\", &Bindata{})\n}\n\ntype Bindata struct {\n\tpath        string\n\tassetSource *AssetSource\n\tmigrations  *source.Migrations\n}\n\nfunc (b *Bindata) Open(url string) (source.Driver, error) {\n\treturn nil, fmt.Errorf(\"not yet implemented\")\n}\n\nvar (\n\tErrNoAssetSource = fmt.Errorf(\"expects *AssetSource\")\n)\n\nfunc WithInstance(instance interface{}) (source.Driver, error) {\n\tif _, ok := instance.(*AssetSource); !ok {\n\t\treturn nil, ErrNoAssetSource\n\t}\n\tas := instance.(*AssetSource)\n\n\tbn := &Bindata{\n\t\tpath:        \"<go-bindata>\",\n\t\tassetSource: as,\n\t\tmigrations:  source.NewMigrations(),\n\t}\n\n\tfor _, fi := range as.Names {\n\t\tm, err := source.DefaultParse(fi)\n\t\tif err != nil {\n\t\t\tcontinue // ignore files that we can't parse","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/golang-migrate/migrate/blob/01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a/source/go_bindata/go-bindata.go#L23-L59","documentation":"ErrNoAssetSource is returned by the go-bindata driver's WithInstance when the instance argument is not a *AssetSource. WithInstance requires the caller to pass the driver's own configuration struct; any other value is rejected with this sentinel error.","triggerScenarios":"Calling bindata.WithInstance with nil, a *Bindata, a string, or any type other than &AssetSource{...}.","commonSituations":"Passing the output of a different driver's WithInstance, passing asset functions (Asset/AssetDir) individually instead of the wrapping struct, or a type mismatch after refactoring imports to a different bindata package.","solutions":["Pass an *AssetSource value: bindata.WithInstance(&bindata.AssetSource{Asset: Asset, AssetDir: AssetDir})","Verify you are using the correct bindata package (the one matching your generated assets)","Nil-check the value before passing it so you fail with a clearer message"],"exampleFix":"// before\nd, err := bindata.WithInstance(Asset)\n// after\nas := &bindata.AssetSource{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo}\nd, err := bindata.WithInstance(as)","handlingStrategy":"type-guard","validationCode":"if assetSource == nil {\n    return fmt.Errorf(\"asset source must be non-nil *bindata.AssetSource\")\n}","typeGuard":"func asAssetSource(v interface{}) (*bindata.AssetSource, bool) {\n    as, ok := v.(*bindata.AssetSource)\n    return as, ok && as != nil\n}","tryCatchPattern":"d, err := bindata.WithInstance(v)\nif errors.Is(err, bindata.ErrNoAssetSource) {\n    return fmt.Errorf(\"WithInstance requires *bindata.AssetSource, got %T\", v)\n}","preventionTips":["Always construct the driver from a literal &bindata.AssetSource{...}","Check for nil before passing instance values around","Keep bindata import paths consistent across the project"],"tags":["go-bindata","type-error","config"],"backgroundTag":"invalid-argument-value","analyzedSha":"01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a","analyzedAt":"2026-09-02T19:38:29.671Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}