amir20/dozzle · error

creating subscription

Error message

creating subscription: %w

What it means

After building a Subscription, addSubscriptionResponse persists it via svc.AddSubscription(sub). A failure there (persist to notifications.yml, invalid destination reference, dispatcher registration) is wrapped as 'creating subscription'.

Solutions

  1. Verify the notifications data directory is writable by the dozzle process
  2. Confirm the destination id exists (create the destination first if needed)
  3. Check server logs for the underlying AddSubscription error for the exact cause

Example fix

// before
docker run -v $(pwd)/ro-data:/data:ro dozzle  # read-only -> persist fails
// after
docker run -v $(pwd)/data:/data dozzle       # writable -> subscription saved
Defensive patterns

Strategy: try-catch

Validate before calling

const dests = await listDestinations(); if (!dests.some(d => d.id === args.destination_id)) throw new Error('destination does not exist: ' + args.destination_id);

Type guard

null

Try / catch

try { await createLogNotification(args) } catch (e) { if (/creating subscription/.test(e.message)) { console.error('persist failed - check data dir writability and destination id:', e.message); } }

Prevention

When it happens

Trigger: Data directory not writable so the subscription cannot be persisted; referenced destination id does not exist; invalid rule configuration rejected by the notification manager.

Common situations: Container run with ./data mounted read-only or not persisted; destination deleted before creating an alert that references it; malformed threshold/metric combination.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


AI-assisted analysis of amir20/dozzle@d9463cbe21 (2026-09-07). Data as JSON: /api/errors/5d6b03750d2dc609. Report an issue: GitHub.

Appendix: source

Thrown at internal/cloud/tools_notifications.go:187

			return fmt.Errorf("%s is required", name)
		}
	}
	return nil
}

func notificationResponse(message string) *pb.CallToolResponse {
	return &pb.CallToolResponse{
		Success: true,
		Result: &pb.CallToolResponse_Notification{Notification: &pb.NotificationResult{
			Success: true,
			Message: message,
		}},
	}
}

func addSubscriptionResponse(svc NotificationService, sub *notification.Subscription) (*pb.CallToolResponse, error) {
	if err := svc.AddSubscription(sub); err != nil {
		return nil, fmt.Errorf("creating subscription: %w", err)
	}

	return notificationResponse(fmt.Sprintf("Created alert %q (id=%d).", sub.Name, sub.ID)), nil
}

View on GitHub (pinned to d9463cbe21)