{"record":{"id":"4ce1833890898152","repo":"amir20/dozzle","slug":"failed-to-start-notification-manager-w","errorCode":null,"errorMessage":"failed to start notification manager: %w","messagePattern":"failed to start notification manager: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/support/cli/agent_command.go","lineNumber":181,"sourceCode":"\n\tctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)\n\tdefer stop()\n\n\t// Create shared client service (single ContainerStore for both agent server and notifications)\n\tclientService := docker_support.NewDockerClientService(client, args.Filter)\n\n\t// Create notification manager using the shared client service\n\tconst notificationConfigPath = \"./data/notifications.yml\"\n\tclients := []container_support.ClientService{clientService}\n\tnotificationManager := notification.NewManager(\n\t\tnotification.NewContainerLogListener(ctx, clients),\n\t\tnotification.NewContainerStatsListener(ctx, clients),\n\t\tnotification.NewContainerEventListener(ctx, clients),\n\t)\n\n\t// Start first so matcher is available for LoadConfig\n\tif err := notificationManager.Start(); err != nil {\n\t\treturn fmt.Errorf(\"failed to start notification manager: %w\", err)\n\t}\n\n\t// Load existing notification config if available\n\tif file, err := os.Open(notificationConfigPath); err == nil {\n\t\tif err := notificationManager.LoadConfig(file); err != nil {\n\t\t\tlog.Warn().Err(err).Msg(\"Failed to load notification config, starting fresh\")\n\t\t} else {\n\t\t\tlog.Info().Str(\"path\", notificationConfigPath).Msg(\"Loaded notification config from disk\")\n\t\t}\n\t\tfile.Close()\n\t}\n\n\t// Create handler that wraps manager and persists config to disk\n\tnotificationHandler := &persistingNotificationHandler{\n\t\tmanager:    notificationManager,\n\t\tconfigPath: notificationConfigPath,\n\t}\n","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/amir20/dozzle/blob/d9463cbe21874e44ab79db6fa63e746ca7d22928/internal/support/cli/agent_command.go#L163-L199","documentation":"Returned by AgentCmd.Run when notificationManager.Start() fails. The manager wires log/stats/event listeners against the Docker client service before the gRPC server comes up, so a failure here means the notification subsystem cannot be initialized and agent startup aborts.","triggerScenarios":"Internal listener startup failure, e.g. the Docker client service cannot establish the event/stat streams it subscribes to, or the manager is started twice / in an invalid state.","commonSituations":"Docker daemon becomes unresponsive between client creation and manager start; a regression or bad state after hot-reloading during development (air); misconfigured filters causing subscription setup to fail.","solutions":["Check agent logs for the wrapped underlying error (%w detail) to identify the failing listener.","Verify the Docker daemon is healthy: `docker events` should stream without error.","Restart the agent; transient daemon disconnects resolve on restart.","Reduce --filter label constraints that may exclude everything and stress listener setup.","Update to the latest dozzle version if the error persists (possible bug)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := agentCmd.Run(args, embeddedCerts); err != nil {\n  var wrapped error\n  if errors.As(err, &wrapped) { log.Error().Err(wrapped).Msg(\"notification manager startup\") }\n  log.Fatal().Err(err).Msg(\"agent startup failed\")\n}","preventionTips":["Read the wrapped %w error to identify the failing listener","Keep the Docker daemon healthy; test `docker events` streams","Avoid restarting the manager manually","Pin and update dozzle versions to get fixes"],"tags":["notifications","agent","startup"],"backgroundTag":"internal-invariant-violation","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"}