usememos/memos · error

name is required

Error message

name is required

What it means

Thrown when validating an identity-provider deployment file (memos-idp-*.json) whose 'name' field is empty or whitespace-only after trimming. The name is the human-readable label shown on the sign-in page, so a blank name makes the IdP unusable. The error aborts startup loading of /etc/secrets and is wrapped with the offending filename.

Source

Thrown at store/deployment_config.go:166

	}
	if err := (protojson.UnmarshalOptions{DiscardUnknown: false}).Unmarshal(content, message); err != nil {
		if matches := protoJSONUnknownFieldMatcher.FindStringSubmatch(err.Error()); len(matches) == 2 {
			return errors.Errorf("failed to decode protobuf JSON: unknown field %q", matches[1])
		}
		return errors.New("failed to decode protobuf JSON; verify field names, value types, and JSON syntax")
	}
	return nil
}

func validateDeploymentIdentityProvider(provider *storepb.IdentityProvider) error {
	if provider.Id != 0 {
		return errors.New("id must be omitted")
	}
	if !base.UIDMatcher.MatchString(provider.Uid) {
		return errors.New("uid is invalid")
	}
	if strings.TrimSpace(provider.Name) == "" {
		return errors.New("name is required")
	}
	if provider.Type != storepb.IdentityProvider_OAUTH2 {
		return errors.New("type must be OAUTH2")
	}
	if provider.IdentifierFilter != "" {
		if _, err := regexp.Compile(provider.IdentifierFilter); err != nil {
			return errors.Wrap(err, "identifierFilter must be a valid regular expression")
		}
	}
	config := provider.Config.GetOauth2Config()
	if config == nil {
		return errors.New("config.oauth2Config is required")
	}
	required := []struct {
		name  string
		value string
	}{
		{name: "clientId", value: config.ClientId},

View on GitHub (pinned to 14d757ce1f)

Solutions

  1. Add a non-empty "name" to the memos-idp-*.json file, e.g. "name": "GitHub".
  2. If the name comes from a templating step, verify the rendered JSON actually contains the value before deploying.

Example fix

// before
{ "uid": "github", "type": "OAUTH2", "config": { ... } }

// after
{ "uid": "github", "name": "GitHub", "type": "OAUTH2", "config": { ... } }
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(name) == "" {
    return errors.New("idp name must not be blank")
}

Type guard

func hasDisplayName(name string) bool { return strings.TrimSpace(name) != "" }

Prevention

When it happens

Trigger: A memos-idp-*.json that omits the "name" key entirely, sets it to "", or sets it to " ".

Common situations: Hand-minimal JSON where the author assumed uid doubles as the display name; template substitution (e.g. envsubst) producing an empty name; YAML-to-JSON conversion dropping the field.

Related errors


AI-assisted analysis of usememos/memos@14d757ce1f (2026-08-15). Data as JSON: /api/errors/e776bd9c32cca11f. Report an issue: GitHub.