usememos/memos · error
default storage is not configured
Error message
default storage is not configured
What it means
SaveAttachmentBlob could not find a default storage in the instance storage settings, so it has nowhere to write the attachment blob. Before this check it already failed loudly if the setting itself could not be read; nil default storage means the config was never initialized or was emptied.
Source
Thrown at server/router/api/v1/attachment_service_storage.go:59
// In particular, never expose an expiring S3 presigned URL as attachment API
// metadata because it can outlive a memo visibility change.
if attachment.StorageType == storepb.AttachmentStorageType_EXTERNAL {
attachmentMessage.ExternalLink = attachment.Reference
}
return attachmentMessage
}
// SaveAttachmentBlob saves the blob of attachment based on the storage config.
func SaveAttachmentBlob(ctx context.Context, profile *profile.Profile, stores *store.Store, create *store.Attachment) error {
instanceStorageSetting, err := stores.GetInstanceStorageSetting(ctx)
if err != nil {
return errors.Wrap(err, "Failed to find instance storage setting")
}
defaultStorage := store.GetDefaultStorage(instanceStorageSetting)
if defaultStorage == nil {
return errors.New("default storage is not configured")
}
if defaultStorage.Type == storepb.StorageType_STORAGE_TYPE_LOCAL {
filepathTemplate := "assets/{timestamp}_{uuid}_{filename}"
if instanceStorageSetting.FilepathTemplate != "" {
filepathTemplate = instanceStorageSetting.FilepathTemplate
}
internalPath := filepathTemplate
if !strings.Contains(internalPath, "{filename}") {
internalPath = filepath.Join(internalPath, "{filename}")
}
internalPath = replaceFilenameWithPathTemplate(internalPath, create.Filename)
internalPath = filepath.ToSlash(internalPath)
// Ensure the directory exists.
osPath := filepath.FromSlash(internalPath)
if !filepath.IsAbs(osPath) {View on GitHub (pinned to 14d757ce1f)
Solutions
- As admin, open Settings -> Storage and set/configure a default storage type (typically Local), then retry the upload
- If settings look correct, inspect the instance storage setting in the DB (system_setting) for a malformed/missing value and re-save it from the UI
- For programmatic setups, ensure the storage system setting is written before any attachment upload API is called
Defensive patterns
Strategy: validation
Validate before calling
// Startup/health check: fail fast if storage is unconfigured before accepting uploads
setting, err := stores.GetInstanceStorageSetting(ctx)
if err != nil { log.Fatal(err) }
if store.GetDefaultStorage(setting) == nil {
log.Fatal("default storage is not configured; set it in Settings -> Storage before enabling uploads")
} Try / catch
// At upload time, translate to a clear admin-actionable error
if err := SaveAttachmentBlob(ctx, profile, stores, create); err != nil {
if strings.Contains(err.Error(), "default storage is not configured") {
return status.Errorf(codes.FailedPrecondition, "instance storage is not configured; an admin must set a default storage type")
}
return err
} Prevention
- Complete storage setup during initial instance installation
- Include a storage-config check in deployment health checks
- After DB restores or migrations, verify system settings rows before reopening uploads
When it happens
Trigger: Uploading/creating an attachment on an instance whose storage settings lack a marked-default storage type; fresh installs where the storage setting row was not seeded; configs edited (via API or direct DB) to remove the default flag.
Common situations: Instance migrated or restored without system settings data; manual tampering with the `system_setting` storage row; partially completed setup where the admin skipped the storage step; version upgrades that changed the storage-setting schema shape.
Related errors
- storageSetting must be populated for key STORAGE
- storageSetting.s3Config is required for S3
- storageSetting.uploadSizeLimitMb must not be negative
- storageSetting default storage S3 config is required
- attachment storage is not configured
AI-assisted analysis of usememos/memos@14d757ce1f (2026-08-15).
Data as JSON: /api/errors/f7ffc4de2b2f300e.
Report an issue: GitHub.