{"record":{"id":"bd8004fbbfa3e56d","repo":"golang-migrate/migrate","slug":"open-cannot-be-called-on-the-httpfs-passthrough","errorCode":null,"errorMessage":"open() cannot be called on the httpfs passthrough driver","messagePattern":"open\\(\\) cannot be called on the httpfs passthrough driver","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"source/httpfs/driver.go","lineNumber":30,"sourceCode":"// used as a migration source for the main migrate library.\ntype driver struct {\n\tPartialDriver\n}\n\n// New creates a new migrate source driver from a http.FileSystem instance and a\n// relative path to migration files within the virtual FS.\nfunc New(fs http.FileSystem, path string) (source.Driver, error) {\n\tvar d driver\n\tif err := d.Init(fs, path); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &d, nil\n}\n\n// Open completes the implementetion of source.Driver interface. Other methods\n// are implemented by the embedded PartialDriver struct.\nfunc (d *driver) Open(url string) (source.Driver, error) {\n\treturn nil, errors.New(\"open() cannot be called on the httpfs passthrough driver\")\n}\n","sourceCodeStart":12,"sourceCodeEnd":32,"githubUrl":"https://github.com/golang-migrate/migrate/blob/01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a/source/httpfs/driver.go#L12-L32","documentation":"The httpfs package provides a passthrough driver built by NewDriver (returning a PartialDriver with Open pre-set). Its Open method is intentionally unimplemented: instances are created via NewDriver, not via the Open(url) factory protocol, so calling Open always returns this error. It exists only to satisfy the source.Driver interface.","triggerScenarios":"Calling Open on a driver obtained from httpfs.New (via NewDriver) instead of the already-constructed driver instance; registering the passthrough driver in a scheme registry where Open is then invoked by source.Open(url).","commonSituations":"Embedding httpfs's driver in a custom source driver and forgetting to override Open; trying to instantiate an http.fs source through the URL-based registry (\"httpfs://...\") instead of passing the driver directly.","solutions":["Do not call Open; use the driver instance returned by httpfs.New with source drivers directly, e.g. pass it to source.Open via NewWithSourceDriver.","If embedding PartialDriver for a custom driver, implement your own Open(url) that constructs and returns your driver instead of inheriting the panicking passthrough.","If you need URL-based construction for http content, use a custom driver whose Open parses the URL and builds an http.FileSystem."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"d, err := httpfs.New(http FS) // construct via New; never route it through a URL registry\nif err != nil { return err }","typeGuard":null,"tryCatchPattern":"drv, err := driver.Open(url)\nif err != nil && strings.Contains(err.Error(), \"httpfs passthrough\") {\n    return fmt.Errorf(\"use httpfs.New() to obtain this driver; Open is not supported\")\n}","preventionTips":["Obtain passthrough drivers only from their constructors (httpfs.New / NewDriver), not via Open.","When embedding PartialDriver in a custom driver, always implement your own Open.","Do not register passthrough drivers in the URL scheme registry."],"tags":["httpfs","source-driver","misuse"],"backgroundTag":"driver-open-not-implemented","analyzedSha":"01a9643f1475e75bb6d6224ddeaf9d8e2434ca8a","analyzedAt":"2026-09-02T19:38:29.671Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}