juicedata/juicefs · error
open %s: %s
Error message
open %s: %s
What it means
xorm.NewEngine failed to construct the database engine for the given driver/URI. This wraps driver-registration and DSN validation failures — the database was never connected to; the URI is malformed for the chosen driver or the driver is unavailable in the build.
Source
Thrown at pkg/object/sql.go:186
var searchPath string
if driver == "postgres" {
uri = "postgres://" + uri
driver = "pgx"
parse, err := url.Parse(uri)
if err != nil {
return nil, fmt.Errorf("parse url %s failed: %s", uri, err)
}
searchPath = parse.Query().Get("search_path")
if searchPath != "" {
if len(strings.Split(searchPath, ",")) > 1 {
return nil, fmt.Errorf("currently, only one schema is supported in search_path")
}
}
}
engine, err := xorm.NewEngine(driver, uri)
if err != nil {
return nil, fmt.Errorf("open %s: %s", uri, err)
}
switch logger.Level { // make xorm less verbose
case logrus.TraceLevel:
engine.SetLogLevel(log.LOG_DEBUG)
case logrus.DebugLevel:
engine.SetLogLevel(log.LOG_INFO)
case logrus.InfoLevel, logrus.WarnLevel:
engine.SetLogLevel(log.LOG_WARNING)
case logrus.ErrorLevel:
engine.SetLogLevel(log.LOG_ERR)
default:
engine.SetLogLevel(log.LOG_OFF)
}
if searchPath != "" {
engine.SetSchema(searchPath)
}
engine.SetTableMapper(names.NewPrefixMapper(engine.GetTableMapper(), "jfs_"))
if err := engine.Sync2(new(blob)); err != nil {View on GitHub (pinned to c9a67b23e8)
Solutions
- Check the metadata URL scheme matches a supported driver exactly: sqlite3://, mysql://, postgres://.
- If using the juicefs.lite build, switch to the full binary — lite disables most SQL/KV drivers.
- Validate the DSN against the driver's documented format (e.g. mysql: user:pass@tcp(host:3306)/db).
Example fix
// before ./juicefs.lite format sqlite3://test.db myjfs // driver not compiled in // after ./juicefs format sqlite3://test.db myjfs // full build registers sqlite3 driver
Defensive patterns
Strategy: try-catch
Validate before calling
// ensure driver is registered in your build
import ( _ "github.com/go-sql-driver/mysql"; _ "github.com/lib/pq"; _ "github.com/mattn/go-sqlite3" )
if !supportedDriver(driver) { return fmt.Errorf("driver %q not compiled in", driver) } Try / catch
engine, err := xorm.NewEngine(driver, uri)
if err != nil {
return fmt.Errorf("check driver name and DSN format for %q: %w", driver, err)
} Prevention
- Match the URL scheme to a supported driver exactly (sqlite3://, mysql://, postgres://).
- Use the full juicefs binary when using SQL/KV metadata engines (lite build disables drivers).
- Validate DSN against the driver's docs before deploying.
When it happens
Trigger: newSQLStore called with a driver name xorm doesn't know (or that wasn't imported/registered), or a DSN string invalid for that driver (e.g. sqlite path with bad syntax, mysql DSN missing mandatory parameters).
Common situations: Typo in the driver part of the JuiceFS metadata URL (e.g. 'sqlite3://...' with lite build lacking the driver); malformed MySQL DSN options; unsupported scheme passed through.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- parse url %s failed: %s
- currently, only one schema is supported in search_path
- invalid hour number
- The entry of the root inode was not found
- not inserted or updated
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/a04669643dda6599.
Report an issue: GitHub.