usememos/memos · error
storageSetting.uploadSizeLimitMb must not be negative
Error message
storageSetting.uploadSizeLimitMb must not be negative
What it means
Thrown during STORAGE instance-setting validation when storageSetting.uploadSizeLimitMb is negative. The field is optional (0 means server default) but a negative limit is meaningless; validation runs after NormalizeInstanceStorageSetting, so a normalizer that produced a negative value from malformed input would also surface here. The deployment file is rejected at startup.
Source
Thrown at store/deployment_config.go:243
if setting.GetGeneralSetting() == nil {
return errors.New("generalSetting must be populated for key GENERAL")
}
if offset := setting.GetGeneralSetting().WeekStartDayOffset; offset < -1 || offset > 6 {
return errors.New("generalSetting.weekStartDayOffset must be between -1 and 6")
}
case storepb.InstanceSettingKey_STORAGE:
storage := setting.GetStorageSetting()
if storage == nil {
return errors.New("storageSetting must be populated for key STORAGE")
}
// Normalization would silently self-heal this misconfiguration to LOCAL;
// a deployment file declaring S3 without a config should fail loudly.
if storage.StorageType == storepb.InstanceStorageSetting_S3 && storage.S3Config == nil && len(storage.Storages) == 0 {
return errors.New("storageSetting.s3Config is required for S3")
}
NormalizeInstanceStorageSetting(storage)
if storage.UploadSizeLimitMb < 0 {
return errors.New("storageSetting.uploadSizeLimitMb must not be negative")
}
defaultStorage := GetDefaultStorage(storage)
if defaultStorage != nil && defaultStorage.Type == storepb.StorageType_STORAGE_TYPE_S3 {
s3Config := defaultStorage.GetS3Config()
if s3Config == nil {
return errors.New("storageSetting default storage S3 config is required")
}
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) == "" {View on GitHub (pinned to 14d757ce1f)
Solutions
- Set uploadSizeLimitMb to 0 to use the default limit, or a positive number of megabytes.
- If you need unlimited uploads, omit the field rather than using a negative sentinel.
Example fix
// before
{ "key": "STORAGE", "storageSetting": { "storageType": "LOCAL", "uploadSizeLimitMb": -1 } }
// after
{ "key": "STORAGE", "storageSetting": { "storageType": "LOCAL", "uploadSizeLimitMb": 0 } } Defensive patterns
Strategy: validation
Validate before calling
if st.UploadSizeLimitMb < 0 {
return fmt.Errorf("uploadSizeLimitMb %d must be >= 0", st.UploadSizeLimitMb)
} Type guard
func isValidUploadSizeLimitMb(v int32) bool { return v >= 0 } Prevention
- 0 means 'use the default'; there is no unlimited sentinel, so never use -1.
- Unit-check config generators: this field is megabytes, not bytes.
When it happens
Trigger: A memos-instance-setting-storage.json with "uploadSizeLimitMb": -1 or a templating bug rendering a negative number.
Common situations: Using -1 as an 'unlimited' sentinel (not supported here); arithmetic in a config generator producing a negative value; unit confusion (bytes vs MB) leading to attempts to set a tiny/negative number.
Related errors
- storageSetting must be populated for key STORAGE
- storageSetting.s3Config is required for S3
- storageSetting default storage S3 config is required
- uid is invalid
- name is required
AI-assisted analysis of usememos/memos@14d757ce1f (2026-08-15).
Data as JSON: /api/errors/f4f2016b81eff56e.
Report an issue: GitHub.