openimsdk/open-im-server · error

invalid object enable: %s

Error message

invalid object enable: %s

What it means

The third RPC service's Start selects an object-storage implementation from config.RpcConfig.Object.Enable ('minio', 'cos', 'oss', 'kodo', 'aws', or empty to disable). An unrecognized value hits the default branch and returns 'invalid object enable: %s'. The config value must exactly match one of the supported provider keys.

Source

Thrown at internal/rpc/third/third.go:103

	thirdCache := redis.NewThirdCache(rdb)
	// Select the oss method according to the profile policy
	var o s3.Interface
	switch enable := config.RpcConfig.Object.Enable; enable {
	case "minio":
		minioCache := redis.NewMinioCache(rdb)
		o, err = minio.NewMinio(ctx, minioCache, *config.MinioConfig.Build())
	case "cos":
		o, err = cos.NewCos(*config.RpcConfig.Object.Cos.Build())
	case "oss":
		o, err = oss.NewOSS(*config.RpcConfig.Object.Oss.Build())
	case "kodo":
		o, err = kodo.NewKodo(*config.RpcConfig.Object.Kodo.Build())
	case "aws":
		o, err = aws.NewAws(*config.RpcConfig.Object.Aws.Build())
	case "":
		o = disable.NewDisable()
	default:
		err = fmt.Errorf("invalid object enable: %s", enable)
	}
	if err != nil {
		return err
	}
	userConn, err := client.GetConn(ctx, config.Discovery.RpcService.User)
	if err != nil {
		return err
	}
	localcache.InitLocalCache(&config.LocalCacheConfig)
	third.RegisterThirdServer(server, &thirdServer{
		thirdDatabase: controller.NewThirdDatabase(thirdCache, logdb),
		s3dataBase:    controller.NewS3Database(rdb, o, s3db),
		defaultExpire: time.Hour * 24 * 7,
		config:        config,
		s3:            o,
		userClient:    rpcli.NewUserClient(userConn),
	})
	return nil

View on GitHub (pinned to 175a7bb067)

Solutions

  1. Set object.enable in the config to one of: minio, cos, oss, kodo, aws (or leave empty to disable object storage)
  2. Check for case sensitivity/typos in the enable value
  3. Upgrade/downgrade to a version that supports the intended provider if it isn't in the switch

Example fix

// before (config.yml)
object: { enable: s3 }
// after
object: { enable: aws }
Defensive patterns

Strategy: validation

Validate before calling

var validObjectStores = map[string]bool{"minio": true, "cos": true, "oss": true, "kodo": true, "aws": true, "": true}
if !validObjectStores[strings.ToLower(cfg.Object.Enable)] {
	return fmt.Errorf("object.enable must be one of minio|cos|oss|kodo|aws or empty, got %q", cfg.Object.Enable)
}

Prevention

When it happens

Trigger: config.RpcConfig.Object.Enable is set to a string not handled by the switch — typo (e.g. 'Minio', 'minIO'), wrong provider name ('s3' instead of 'aws'), or garbage — during third service startup.

Common situations: Hand-edited config.yml with a misspelled object.enable; migrating between providers and leaving a placeholder value; docs vs code drift where a provider isn't supported in this version.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of openimsdk/open-im-server@175a7bb067 (2026-09-04). Data as JSON: /api/errors/65cabe0cb02f65f9. Report an issue: GitHub.