{"record":{"id":"5ea876f16f6690e0","repo":"xai-org/x-algorithm","slug":"renew-interval-must-be-greater-than-0","errorCode":null,"errorMessage":"Renew interval must be greater than 0","messagePattern":"Renew interval must be greater than 0","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"grox/libs/kerberos_cli/kerberos.py","lineNumber":28,"sourceCode":"\nclass KerberosConfig(BaseModel):\n    keytab_path: str\n    principal: str\n    renew_interval: int = 3600\n    attempts: int = 5\n    retry_interval: int = 60\n\n\nclass KerberosRenewer:\n    def __init__(self, keytab_path: str, principal: str, **kwargs):\n        self._renewer: asyncio.Task | None = None\n        self.config = KerberosConfig(\n            keytab_path=keytab_path, principal=principal, **kwargs\n        )\n        if not Path(self.config.keytab_path).exists():\n            raise FileNotFoundError(f\"Keytab file not found: {self.config.keytab_path}\")\n        if self.config.renew_interval <= 0:\n            raise ValueError(\"Renew interval must be greater than 0\")\n        if self.config.attempts <= 0:\n            raise ValueError(\"Attempts must be greater than 0\")\n        if self.config.retry_interval <= 0:\n            raise ValueError(\"Retry interval must be greater than 0\")\n\n    async def _kerberos_renewal_loop(self):\n        while True:\n            attempts = self.config.attempts\n            while attempts > 0:\n                attempts -= 1\n                try:\n                    await self._renew_kerberos_ticket()\n                    logger.info(\n                        f\"Kerberos ticket renewed successfully for {self.config.principal}\"\n                    )\n                    break\n                except Exception:\n                    if attempts == 0:","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/grox/libs/kerberos_cli/kerberos.py#L10-L46","documentation":"KerberosConfig.renew_interval controls how often the background renewal loop refreshes the TGT. __init__ rejects values <= 0 because a non-positive interval would spin the loop or disable renewal entirely. It is a straightforward pydantic-era numeric sanity check at construction time.","triggerScenarios":"KerberosClient(..., renew_interval=0) or a negative value, typically from a config default that was never set or parsed as 0.","commonSituations":"Config file with renew_interval commented out and a fallback of 0; unit-sourced value where someone confused seconds with milliseconds and set 0 to 'use default'; templating emitting 0 for optional fields.","solutions":["Set renew_interval to a positive number of seconds (commonly well under the 24h TGT lifetime, e.g. 3600).","Fix the config source so the omitted field resolves to a sane default instead of 0."],"exampleFix":"# before\nclient = KerberosClient(kt, principal, renew_interval=0)  # ValueError\n\n# after\nclient = KerberosClient(kt, principal, renew_interval=3600)","handlingStrategy":"validation","validationCode":"renew_interval = renew_interval or 3600\nassert renew_interval > 0\nclient = KerberosClient(kt, principal, renew_interval=renew_interval)","typeGuard":null,"tryCatchPattern":"try:\n    client = KerberosClient(kt, p, renew_interval=ri)\nexcept ValueError as e:\n    if 'Renew interval' in str(e):\n        client = KerberosClient(kt, p, renew_interval=3600)\n    else:\n        raise","preventionTips":["Give all Kerberos numeric configs positive defaults","Validate intervals as positive ints in settings models"],"tags":["kerberos","config-validation","numeric-limits"],"backgroundTag":"invalid-config-value","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}