{"record":{"id":"b5d7156dd4f12171","repo":"zylon-ai/private-gpt","slug":"visibility-timeout-should-be-greater-than-soft-tim","errorCode":null,"errorMessage":"Visibility timeout should be greater than soft time limit","messagePattern":"Visibility timeout should be greater than soft time limit","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"private_gpt/settings/settings.py","lineNumber":1177,"sourceCode":"    def validate_config(self) -> bool:\n        # Check if visibility timeout is set when broker or backend is redis\n        if self.broker_mode == \"redis\" or self.backend_mode == \"redis\":\n            if not self.visibility_timeout:\n                raise ValueError(\n                    \"Visibility timeout should be set when broker or backend is Redis\"\n                )\n\n        if self.soft_time_limit:\n            if self.hard_time_limit and self.soft_time_limit > self.hard_time_limit:\n                raise ValueError(\n                    \"Soft time limit should be less than or equal to hard time limit\"\n                )\n\n            if (\n                self.visibility_timeout\n                and self.visibility_timeout < self.soft_time_limit\n            ):\n                raise ValueError(\n                    \"Visibility timeout should be greater than soft time limit\"\n                )\n\n        if self.hard_time_limit:\n            if (\n                self.visibility_timeout\n                and self.visibility_timeout < self.hard_time_limit\n            ):\n                raise ValueError(\n                    \"Visibility timeout should be greater than hard time limit\"\n                )\n\n        return True\n\n\nclass RedisSettings(BaseModel):\n    host: str = Field(description=\"Redis host\")\n    username: str | None = Field(default=None, description=\"Redis username\")","sourceCodeStart":1159,"sourceCodeEnd":1195,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/settings/settings.py#L1159-L1195","documentation":"Config-validation ValueError from CelerySettings.validate_config: when soft_time_limit and visibility_timeout are both set, visibility_timeout must be >= soft_time_limit. With a Redis broker, a task still running past the visibility window gets redelivered to another worker — so the window must outlast any task that could hit its soft limit.","triggerScenarios":"Redis broker config with visibility_timeout: 60 and soft_time_limit: 300; adding task time limits to an existing Redis setup whose visibility_timeout was set barely above typical runtime; copying a visibility_timeout from a short-task example into a long-task deployment.","commonSituations":"Adding soft_time_limit after Redis was already configured; lowering visibility_timeout to reduce redelivery latency; per-env overrides drifting so only one of the two values is updated on deploys.","solutions":["Raise visibility_timeout to at least soft_time_limit (preferably well above, e.g. soft + headroom).","Or lower soft_time_limit if long tasks are not intended.","Re-check the pair whenever either value changes; keep visibility_timeout > hard_time_limit too (the next validator enforces that).","Restart workers after the change — visibility_timeout is applied at broker connection time."],"exampleFix":"# before\ncelery:\n  broker_mode: redis\n  visibility_timeout: 60\n  soft_time_limit: 300\n# after\ncelery:\n  broker_mode: redis\n  visibility_timeout: 3600\n  soft_time_limit: 300","handlingStrategy":"validation","validationCode":"soft, vis = cfg['celery'].get('soft_time_limit'), cfg['celery'].get('visibility_timeout')\nif soft and vis:\n    assert vis >= soft, f'visibility_timeout ({vis}) must be >= soft_time_limit ({soft})'","typeGuard":"const visibilityCoversSoft = (c: { visibility_timeout?: number; soft_time_limit?: number }): boolean =>\n  c.visibility_timeout == null || c.soft_time_limit == null || c.visibility_timeout >= c.soft_time_limit;","tryCatchPattern":null,"preventionTips":["Set visibility_timeout to hard_time_limit + headroom to satisfy all ordering checks at once.","Revisit the value whenever task duration limits change.","Monitor for duplicated task executions — the symptom of a too-small window."],"tags":["celery","redis","configuration","timeouts","task-queue"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}