juicedata/juicefs · error

currently, only one schema is supported in search_path

Error message

currently, only one schema is supported in search_path

What it means

When a postgres metadata URL specifies a search_path query parameter, newSQLStore enforces that only a single schema is supported. Passing a comma-separated list (e.g. search_path=a,b) is rejected at construction time because the driver sets exactly one xorm schema.

Source

Thrown at pkg/object/sql.go:180

func newSQLStore(driver, addr, user, password string) (ObjectStorage, error) {
	var err error
	uri := addr
	if user != "" {
		uri = user + ":" + password + "@" + addr
	}
	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)

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Use exactly one schema in the URL: ?search_path=myschema.
  2. Pre-create the target schema in the database and grant the user USAGE/CREATE on it.
  3. If you need multiple schemas, run separate JuiceFS volumes, one per schema.

Example fix

// before
meta := "postgres://user:pw@host/db?search_path=public,jfs"
// after
meta := "postgres://user:pw@host/db?search_path=jfs"
Defensive patterns

Strategy: validation

Validate before calling

if sp := parse.Query().Get("search_path"); strings.Contains(sp, ",") {
    return fmt.Errorf("search_path must contain exactly one schema, got %q", sp)
}

Try / catch

if err != nil && err.Error() == "currently, only one schema is supported in search_path" {
    // reduce search_path to a single schema in the metadata URL
}

Prevention

When it happens

Trigger: Using a JuiceFS metadata URL like 'postgres://user:pw@host/db?search_path=schema1,schema2' — any search_path value containing a comma triggers this error.

Common situations: Copying a search_path from a psql/postgres client config that defaults to "$user",public (note the comma) and pasting it into the JuiceFS metadata URL.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/98c13e855a39d0ea. Report an issue: GitHub.