{"record":{"id":"5d6b03750d2dc609","repo":"amir20/dozzle","slug":"creating-subscription-w","errorCode":null,"errorMessage":"creating subscription: %w","messagePattern":"creating subscription: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cloud/tools_notifications.go","lineNumber":187,"sourceCode":"\t\t\treturn fmt.Errorf(\"%s is required\", name)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc notificationResponse(message string) *pb.CallToolResponse {\n\treturn &pb.CallToolResponse{\n\t\tSuccess: true,\n\t\tResult: &pb.CallToolResponse_Notification{Notification: &pb.NotificationResult{\n\t\t\tSuccess: true,\n\t\t\tMessage: message,\n\t\t}},\n\t}\n}\n\nfunc addSubscriptionResponse(svc NotificationService, sub *notification.Subscription) (*pb.CallToolResponse, error) {\n\tif err := svc.AddSubscription(sub); err != nil {\n\t\treturn nil, fmt.Errorf(\"creating subscription: %w\", err)\n\t}\n\n\treturn notificationResponse(fmt.Sprintf(\"Created alert %q (id=%d).\", sub.Name, sub.ID)), nil\n}\n","sourceCodeStart":169,"sourceCodeEnd":192,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/internal/cloud/tools_notifications.go#L169-L192","documentation":"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'.","triggerScenarios":"Data directory not writable so the subscription cannot be persisted; referenced destination id does not exist; invalid rule configuration rejected by the notification manager.","commonSituations":"Container run with ./data mounted read-only or not persisted; destination deleted before creating an alert that references it; malformed threshold/metric combination.","solutions":["Verify the notifications data directory is writable by the dozzle process","Confirm the destination id exists (create the destination first if needed)","Check server logs for the underlying AddSubscription error for the exact cause"],"exampleFix":"// before\ndocker run -v $(pwd)/ro-data:/data:ro dozzle  # read-only -> persist fails\n// after\ndocker run -v $(pwd)/data:/data dozzle       # writable -> subscription saved","handlingStrategy":"try-catch","validationCode":"const dests = await listDestinations(); if (!dests.some(d => d.id === args.destination_id)) throw new Error('destination does not exist: ' + args.destination_id);","typeGuard":"null","tryCatchPattern":"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); } }","preventionTips":["Ensure the dozzle data volume is writable (not mounted :ro)","Create destinations before alerts that reference them","Check container logs for the wrapped AddSubscription cause"],"tags":["cloud-tools","notifications","persistence"],"backgroundTag":"file-write-failed","analyzedSha":"d9463cbe21874e44ab79db6fa63e746ca7d22928","analyzedAt":"2026-09-07T10:08:55.855Z","contentChangedAt":"2026-09-07T10:08:55.855Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}