{"record":{"id":"1ec31f23c12e4566","repo":"thanos-io/thanos","slug":"canceled","errorCode":null,"errorMessage":"canceled","messagePattern":"canceled","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/thanos/main.go","lineNumber":183,"sourceCode":"\t}\n\n\tif err := g.Run(); err != nil {\n\t\t// Use %+v for github.com/pkg/errors error to print with stack.\n\t\tlevel.Error(logger).Log(\"err\", fmt.Sprintf(\"%+v\", errors.Wrapf(err, \"%s command failed\", cmd)))\n\t\tos.Exit(1)\n\t}\n\tlevel.Info(logger).Log(\"msg\", \"exiting\")\n}\n\nfunc interrupt(logger log.Logger, cancel <-chan struct{}) error {\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, syscall.SIGINT, syscall.SIGTERM)\n\tselect {\n\tcase s := <-c:\n\t\tlevel.Info(logger).Log(\"msg\", \"caught signal. Exiting.\", \"signal\", s)\n\t\treturn nil\n\tcase <-cancel:\n\t\treturn errors.New(\"canceled\")\n\t}\n}\n\nfunc reload(logger log.Logger, cancel <-chan struct{}, r chan<- struct{}) error {\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, syscall.SIGHUP)\n\tfor {\n\t\tselect {\n\t\tcase s := <-c:\n\t\t\tlevel.Info(logger).Log(\"msg\", \"caught signal. Reloading.\", \"signal\", s)\n\t\t\tselect {\n\t\t\tcase r <- struct{}{}:\n\t\t\t\tlevel.Info(logger).Log(\"msg\", \"reload dispatched.\")\n\t\t\tdefault:\n\t\t\t}\n\t\tcase <-cancel:\n\t\t\treturn errors.New(\"canceled\")\n\t\t}","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/cmd/thanos/main.go#L165-L201","documentation":"interrupt() waits for SIGINT/SIGTERM; if instead the cancel channel closes (meaning some other run-group actor failed or the group is shutting down), it returns errors.New(\"canceled\"). This is Thanos's normal way to terminate the signal-waiting actor when shutdown is initiated elsewhere, and it propagates up to cause a clean exit.","triggerScenarios":"Another run-group actor returns an error or the group is terminated, closing the cancel channel while interrupt() is still blocked waiting on signals; the select then takes the <-cancel branch and returns \"canceled\".","commonSituations":"A component (HTTP/gRPC server, store client) failed and triggered group shutdown; or the group's interrupt/ctx cancel fired during graceful shutdown. Often appears alongside the actual root-cause error in logs.","solutions":["Treat this as a secondary/shutdown error; scan the logs for the earlier root-cause error that closed the cancel channel.","If it appears alone, check whether another component was stopped (systemd, k8s liveness kill, docker stop).","No code fix needed if shutdown was intentional; fix the root failure otherwise."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Treat 'canceled' as expected on shutdown\nif err := g.Run(); err != nil {\n    if errors.Is(errors.Cause(err), context.Canceled) || err.Error() == \"canceled\" {\n        logger.Info(\"graceful shutdown\")\n        return nil\n    }\n    return err\n}","preventionTips":["Always correlate this message with an earlier root-cause error in logs","Alert on the root cause, not on the 'canceled' shutdown message","Use structured logging so the error chain stays greppable"],"tags":["signals","shutdown","run-group"],"backgroundTag":"invalid-state-transition","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}