{"record":{"id":"59688f19006d8a41","repo":"makeplane/plane","slug":"please-check-the-view-59688f","errorCode":null,"errorMessage":"Please check the view","messagePattern":"Please check the view","errorType":"http","errorClass":"APIException","httpStatus":400,"severity":"error","filePath":"apps/api/plane/space/views/base.py","lineNumber":63,"sourceCode":"class BaseViewSet(TimezoneMixin, ModelViewSet, BasePaginator):\n    model = None\n\n    permission_classes = [IsAuthenticated]\n\n    filter_backends = (DjangoFilterBackend, SearchFilter)\n\n    authentication_classes = [BaseSessionAuthentication]\n\n    filterset_fields = []\n\n    search_fields = []\n\n    def get_queryset(self):\n        try:\n            return self.model.objects.all()\n        except Exception as e:\n            log_exception(e)\n            raise APIException(\"Please check the view\", status.HTTP_400_BAD_REQUEST)\n\n    def handle_exception(self, exc):\n        \"\"\"\n        Handle any exception that occurs, by returning an appropriate response,\n        or re-raising the error.\n        \"\"\"\n        try:\n            response = super().handle_exception(exc)\n            return response\n        except Exception as e:\n            if isinstance(e, IntegrityError):\n                return Response(\n                    {\"error\": \"The payload is not valid\"},\n                    status=status.HTTP_400_BAD_REQUEST,\n                )\n\n            if isinstance(e, ValidationError):\n                return Response(","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/makeplane/plane/blob/1c8a60f858d8472aa56e29994ec1c7926da2c6ce/apps/api/plane/space/views/base.py#L45-L81","documentation":"Generic APIException (HTTP 400) raised by `BaseViewSet.get_queryset` in space/views/base.py when ANY exception occurs while calling `self.model.objects.all()`. The real exception is logged via `log_exception` but masked from the client behind the unhelpful 'Please check the view' message. Because the try wraps a trivial ORM call, this usually indicates a misconfigured view rather than bad client input.","triggerScenarios":"Any Space-app ModelViewSet request where `self.model` is None or unset, the model table is missing/migrated incorrectly, or the DB connection raises. The handler converts every such failure into a 400 with 'Please check the view'.","commonSituations":"Subclass of BaseViewSet that forgot to set the `model` class attribute; pointing at a model whose DB table does not exist (missing migration); database connectivity loss mid-request; serializer/permission code that runs inside get_queryset indirectly.","solutions":["Ensure your BaseViewSet subclass sets `model = YourModel` (and a proper `get_queryset` override if scoping is needed).","Check `log_exception` output / server logs for the real underlying exception - the client message hides it.","Run migrations (`python manage.py migrate`) if the model's table is missing.","Consider returning 500 (not 400) for genuine server-side failures; 400 implies client error which is misleading here."],"exampleFix":"# before\nclass MyViewSet(BaseViewSet):\n    model = None  # triggers the catch\n\n# after\nclass MyViewSet(BaseViewSet):\n    model = Workspace\n    def get_queryset(self):\n        return self.model.objects.filter(workspace__slug=self.workspace_slug)","handlingStrategy":"try-catch","validationCode":"def viewset_is_well_configured(viewset_cls) -> bool:\n    # BaseViewSet subclass must define `model`\n    return getattr(viewset_cls, 'model', None) is not None","typeGuard":null,"tryCatchPattern":"# In your viewset override, narrow the catch instead of trusting the generic one\ndef get_queryset(self):\n    if self.model is None:\n        raise RuntimeError(f'{type(self).__name__} did not set model')\n    return self.model.objects.all()","preventionTips":["Always set `model` (and override get_queryset with scoping) on BaseViewSet subclasses.","Inspect log_exception output - the client message hides the real cause.","Keep migrations applied so model tables exist.","Consider returning 500 for genuine server faults; 400 mislabels them as client errors."],"tags":["drf","viewset","error-handling","space-app"],"backgroundTag":null,"analyzedSha":"1c8a60f858d8472aa56e29994ec1c7926da2c6ce","analyzedAt":"2026-08-12T14:44:31.636Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}