hyperledger/fabric · warning

invalid log level provided - %s

Error message

invalid log level provided - %s

What it means

Validation in CheckLogLevel: the supplied log level string is not one of the levels accepted by flogging (e.g. debug/info/warning/error/critical or a named level). The %s is the invalid value passed by the caller (typically the peer node set-loglevel command).

Source

Thrown at internal/peer/common/common.go:306

		orgAddresses = append(orgAddresses, org.Endpoints()...)
	}

	ordererAddresses := bundle.ChannelConfig().OrdererAddresses()
	if len(orgAddresses) > 0 {
		if len(ordererAddresses) > 0 {
			logger.Warningf("Deprecated global OrdererAddresses exist: %s; ignoring them", ordererAddresses)
		}
		return orgAddresses, nil
	}

	logger.Warningf("Org specific endpoints are missing, returning (deprecated) global OrdererAddresses: %s; ", ordererAddresses)
	return ordererAddresses, nil
}

// CheckLogLevel checks that a given log level string is valid
func CheckLogLevel(level string) error {
	if !flogging.IsValidLevel(level) {
		return errors.Errorf("invalid log level provided - %s", level)
	}
	return nil
}

func configFromEnv(prefix string) (address string, clientConfig comm.ClientConfig, err error) {
	address = viper.GetString(prefix + ".address")
	clientConfig = comm.ClientConfig{}
	connTimeout := viper.GetDuration(prefix + ".client.connTimeout")
	if connTimeout == time.Duration(0) {
		connTimeout = defaultConnTimeout
	}
	clientConfig.DialTimeout = connTimeout
	secOpts := comm.SecureOptions{
		UseTLS:             viper.GetBool(prefix + ".tls.enabled"),
		RequireClientCert:  viper.GetBool(prefix + ".tls.clientAuthRequired"),
		TimeShift:          viper.GetDuration(prefix + ".tls.handshakeTimeShift"),
		ServerNameOverride: viper.GetString(prefix + ".tls.serverhostoverride"),
	}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Use a valid level: debug, info, warning, error, or critical (case-insensitive)
  2. Check for typos in the level string passed to the command or env var
  3. If using a logging spec (module=level), validate the whole spec syntax
  4. List available levels via flogging docs or `peer logging loglevel` output

Example fix

// before
err := common.CheckLogLevel("verbose")
// after
err := common.CheckLogLevel("debug")
Defensive patterns

Strategy: validation

Validate before calling

validLevels := []string{"debug", "info", "warning", "error", "critical"}
func isValidLevel(l string) bool {
    for _, v := range validLevels {
        if strings.EqualFold(l, v) { return true }
    }
    return false
}

Type guard

func validLogLevel(s string) bool { return flogging.IsValidLevel(s) }

Try / catch

if err := common.CheckLogLevel(level); err != nil {
    fmt.Printf("%v; allowed: debug|info|warning|error|critical\n", err)
    os.Exit(2)
}

Prevention

When it happens

Trigger: Calling CheckLogLevel (or log-level-set operations that call it) with a string like "verbose", "trace2", or a misspelled level instead of the accepted ones (debug, info, warning, error, critical, or valid spec strings).

Common situations: Typo in FABRIC_LOGGING_SPEC or in a peer CLI command like `peer node loglevel`, case/format mismatch, or passing a module=level spec that flogging cannot parse.

Related errors


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/6fbd0794444d6ac2. Report an issue: GitHub.