usememos/memos · error

memoRelatedSetting must be populated for key MEMO_RELATED

Error message

memoRelatedSetting must be populated for key MEMO_RELATED

What it means

Thrown when an instance-setting deployment file declares "key": "MEMO_RELATED" but its memoRelatedSetting payload message is nil. Like the other keys, the oneof payload must be present and match the declared key; otherwise the loader rejects the file at startup as an invalid instance setting deployment file. MEMO_RELATED has no deeper per-field validation, so presence is the only requirement.

Source

Thrown at store/deployment_config.go:268

			}
			for _, field := range []struct {
				name  string
				value string
			}{
				{name: "accessKeyId", value: s3Config.AccessKeyId},
				{name: "accessKeySecret", value: s3Config.AccessKeySecret},
				{name: "endpoint", value: s3Config.Endpoint},
				{name: "region", value: s3Config.Region},
				{name: "bucket", value: s3Config.Bucket},
			} {
				if strings.TrimSpace(field.value) == "" {
					return errors.Errorf("storageSetting default S3 config.%s is required", field.name)
				}
			}
		}
	case storepb.InstanceSettingKey_MEMO_RELATED:
		if setting.GetMemoRelatedSetting() == nil {
			return errors.New("memoRelatedSetting must be populated for key MEMO_RELATED")
		}
	case storepb.InstanceSettingKey_NOTIFICATION:
		notification := setting.GetNotificationSetting()
		if notification == nil {
			return errors.New("notificationSetting must be populated for key NOTIFICATION")
		}
		if email := notification.Email; email != nil && email.Enabled {
			if strings.TrimSpace(email.SmtpHost) == "" || email.SmtpPort <= 0 || strings.TrimSpace(email.FromEmail) == "" {
				return errors.New("enabled notification email requires smtpHost, a positive smtpPort, and fromEmail")
			}
			if email.UseTls && email.UseSsl {
				return errors.New("notification email cannot enable both useTls and useSsl")
			}
		}
	case storepb.InstanceSettingKey_AI:
		if setting.GetAiSetting() == nil {
			return errors.New("aiSetting must be populated for key AI")
		}

View on GitHub (pinned to 14d757ce1f)

Solutions

  1. Add a "memoRelatedSetting" object, e.g. { "key": "MEMO_RELATED", "memoRelatedSetting": { "disablePublicMemos": false } }.
  2. Check the payload key is exactly memoRelatedSetting (lowerCamelCase protojson).

Example fix

// before
{ "key": "MEMO_RELATED" }

// after
{ "key": "MEMO_RELATED", "memoRelatedSetting": { "disablePublicMemos": false, "displayWithUpdateTime": false } }
Defensive patterns

Strategy: validation

Validate before calling

if setting.Key == storepb.InstanceSettingKey_MEMO_RELATED && setting.GetMemoRelatedSetting() == nil {
    return errors.New("MEMO_RELATED setting requires a memoRelatedSetting payload")
}

Type guard

func hasMemoRelatedPayload(s *storepb.InstanceSetting) bool {
    return s.GetKey() == storepb.InstanceSettingKey_MEMO_RELATED && s.GetMemoRelatedSetting() != nil
}

Prevention

When it happens

Trigger: A memos-instance-setting-memo-related.json containing only { "key": "MEMO_RELATED" } or with a mistyped payload key ("memo_related", "memoRelated") that protojson does not recognize.

Common situations: Creating a placeholder file to reserve the key; key/payload mismatch after renaming the key in the JSON but not the payload.

Related errors


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