{"record":{"id":"21e8c9013d96d9e7","repo":"usememos/memos","slug":"memorelatedsetting-must-be-populated-for-key-memo","errorCode":null,"errorMessage":"memoRelatedSetting must be populated for key MEMO_RELATED","messagePattern":"memoRelatedSetting must be populated for key MEMO_RELATED","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"store/deployment_config.go","lineNumber":268,"sourceCode":"\t\t\t}\n\t\t\tfor _, field := range []struct {\n\t\t\t\tname  string\n\t\t\t\tvalue string\n\t\t\t}{\n\t\t\t\t{name: \"accessKeyId\", value: s3Config.AccessKeyId},\n\t\t\t\t{name: \"accessKeySecret\", value: s3Config.AccessKeySecret},\n\t\t\t\t{name: \"endpoint\", value: s3Config.Endpoint},\n\t\t\t\t{name: \"region\", value: s3Config.Region},\n\t\t\t\t{name: \"bucket\", value: s3Config.Bucket},\n\t\t\t} {\n\t\t\t\tif strings.TrimSpace(field.value) == \"\" {\n\t\t\t\t\treturn errors.Errorf(\"storageSetting default S3 config.%s is required\", field.name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\tcase storepb.InstanceSettingKey_MEMO_RELATED:\n\t\tif setting.GetMemoRelatedSetting() == nil {\n\t\t\treturn errors.New(\"memoRelatedSetting must be populated for key MEMO_RELATED\")\n\t\t}\n\tcase storepb.InstanceSettingKey_NOTIFICATION:\n\t\tnotification := setting.GetNotificationSetting()\n\t\tif notification == nil {\n\t\t\treturn errors.New(\"notificationSetting must be populated for key NOTIFICATION\")\n\t\t}\n\t\tif email := notification.Email; email != nil && email.Enabled {\n\t\t\tif strings.TrimSpace(email.SmtpHost) == \"\" || email.SmtpPort <= 0 || strings.TrimSpace(email.FromEmail) == \"\" {\n\t\t\t\treturn errors.New(\"enabled notification email requires smtpHost, a positive smtpPort, and fromEmail\")\n\t\t\t}\n\t\t\tif email.UseTls && email.UseSsl {\n\t\t\t\treturn errors.New(\"notification email cannot enable both useTls and useSsl\")\n\t\t\t}\n\t\t}\n\tcase storepb.InstanceSettingKey_AI:\n\t\tif setting.GetAiSetting() == nil {\n\t\t\treturn errors.New(\"aiSetting must be populated for key AI\")\n\t\t}","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/usememos/memos/blob/14d757ce1fb31c78590f374bc042f8dbedbc20d7/store/deployment_config.go#L250-L286","documentation":"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.","triggerScenarios":"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.","commonSituations":"Creating a placeholder file to reserve the key; key/payload mismatch after renaming the key in the JSON but not the payload.","solutions":["Add a \"memoRelatedSetting\" object, e.g. { \"key\": \"MEMO_RELATED\", \"memoRelatedSetting\": { \"disablePublicMemos\": false } }.","Check the payload key is exactly memoRelatedSetting (lowerCamelCase protojson)."],"exampleFix":"// before\n{ \"key\": \"MEMO_RELATED\" }\n\n// after\n{ \"key\": \"MEMO_RELATED\", \"memoRelatedSetting\": { \"disablePublicMemos\": false, \"displayWithUpdateTime\": false } }","handlingStrategy":"validation","validationCode":"if setting.Key == storepb.InstanceSettingKey_MEMO_RELATED && setting.GetMemoRelatedSetting() == nil {\n    return errors.New(\"MEMO_RELATED setting requires a memoRelatedSetting payload\")\n}","typeGuard":"func hasMemoRelatedPayload(s *storepb.InstanceSetting) bool {\n    return s.GetKey() == storepb.InstanceSettingKey_MEMO_RELATED && s.GetMemoRelatedSetting() != nil\n}","tryCatchPattern":null,"preventionTips":["Generate instance-setting files from a live setting via the API so key/payload always match.","Avoid placeholder key-only files in production mounts."],"tags":["configuration","validation","instance-setting","startup"],"backgroundTag":null,"analyzedSha":"14d757ce1fb31c78590f374bc042f8dbedbc20d7","analyzedAt":"2026-08-15T09:27:36.538Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}