{"record":{"id":"0acf31032f222963","repo":"Significant-Gravitas/AutoGPT","slug":"invalid-api-key-0acf31","errorCode":null,"errorMessage":"Invalid API key","messagePattern":"Invalid API key","errorType":"http","errorClass":"HTTPException","httpStatus":401,"severity":"error","filePath":"autogpt_platform/backend/backend/api/utils/api_key_auth.py","lineNumber":99,"sourceCode":"        self.message_if_invalid = message_if_invalid\n\n    async def __call__(self, request: Request) -> Any:\n        api_key = await super().__call__(request)\n        if api_key is None:\n            raise HTTPException(\n                status_code=self.status_if_missing, detail=\"No API key in request\"\n            )\n\n        # Use custom validation if provided, otherwise use default equality check\n        validator = self.custom_validator or self.default_validator\n        result = (\n            await validator(api_key)\n            if inspect.iscoroutinefunction(validator)\n            else validator(api_key)\n        )\n\n        if not result:\n            raise HTTPException(\n                status_code=self.status_if_missing, detail=self.message_if_invalid\n            )\n\n        # Store validation result in request state if it's not just a boolean\n        if result is not True:\n            request.state.api_key = result\n\n        return result\n\n    async def default_validator(self, api_key: str) -> bool:\n        if not self.expected_token:\n            raise MissingConfigError(\n                f\"{self.__class__.__name__}.expected_token is not set; \"\n                \"either specify it or provide a custom validator\"\n            )\n        try:\n            return secrets.compare_digest(api_key, self.expected_token)\n        except TypeError as e:","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/utils/api_key_auth.py#L81-L117","documentation":"Error \"Invalid API key\" thrown in Significant-Gravitas/AutoGPT.","triggerScenarios":"Thrown at autogpt_platform/backend/backend/api/utils/api_key_auth.py:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the API key for typos and that it is active and not revoked.","Generate a new API key and update the client configuration."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}